Giter VIP home page Giter VIP logo

Comments (3)

posva avatar posva commented on May 18, 2024 1

That behaviour is intended. The computed property reacts first to the empty array then firebases fetches data and updates the array again. Nothing to worry about 😉

from vuefire.

jhoganrg avatar jhoganrg commented on May 18, 2024

This is a solution I implemented for what I think to be a similar challenge. ... may or may not be helpful Cheers --

  <v-data-table
      class="ma-3"
      :disable-sort="true"
      :footer-props="{
        itemsPerPageOptions: [5, 10, 25, 100]
      }"
      :headers="headers"
      :loading="loadingChanges"
      :items="tableOptions.records"
      :items-per-page="tableOptions.per_page"
      :options="tableOptions"
      :server-items-length="tableOptions.total_records"
      :search="tableOptions.search"
      @update:options="onTableOptionsUpdate($event)"
    >

methods: {
...
onTableOptionsUpdate: _.debounce(function (newTableOptions) {

   /*
     * Why? Cuz otherwise everything runs twice.
     * 
     * Again you ask Why?
     * 
     * Our TableOptions are instantiated in the store with defaults.
     * On Load we make a call that hydrates the tableOptions... Good
     * 
     * But
     * 
     * That is an update to tableOptions (even if it is the same values) which fires the 
     * @update:options event, which in turn goes out to the API again with the same values as onLoad... BAD
     */
    if (this.apiCallCount === 0) {
      this.getLienholderAddresses(transformedTableOptions);
      this.apiCallCount++;
    } else {
      this.apiCallCount = 0;
    }

from vuefire.

did avatar did commented on May 18, 2024

I know this is a closed issue but I faced the same issue in my app. Here is my solution.

If I take the initial example, I was watching the subscriptions data to stop my loader.
It turned out that it was called twice when I was calling this.$bind('subscriptions', ...).
The first call returned an empty array, the second call, the collection. Oddly, the second call might not occur if my collection was really empty.
Anyway, the trick is to use .then(subscriptions => { /* stop my loader */ } when I do the binding. The promise will be called once anytime.

from vuefire.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.