Giter Site home page Giter Site logo

Comments (5)

mikelehen avatar mikelehen commented on May 18, 2024 1

@IvanBean Thanks for reporting this! I've reproduced the issue and tracked it down to a bug in our local query processing here.

It will happen when you do an update() that causes a document that used to not-match the query to now match the query. Basically, since the original document didn't match the query, we fail to apply the update(), and so it doesn't get considered in the final query results. :-/ As a workaround you could potentially use a set() or set(..., SetOptions.merge()) instead of the update.

We'll take a look at getting this fixed in an upcoming release. Thanks again for reporting it.

from firebase-android-sdk.

var-const avatar var-const commented on May 18, 2024 1

Michael, I think I can do it together with the porting.

from firebase-android-sdk.

samtstern avatar samtstern commented on May 18, 2024

@IvanBean thanks for the specific reproduction steps! Sounds like a bug to me, will wait for @gsoltis or @wilhuff to chime in.

from firebase-android-sdk.

mikelehen avatar mikelehen commented on May 18, 2024

Hrm. That certainly doesn't sound expected. I'll try to reproduce.

from firebase-android-sdk.

mikelehen avatar mikelehen commented on May 18, 2024

@var-const I wonder if this is something you might be able to look at tackling?

I went to try to fix it on web (so I could write a spec test for validation), but realized I wanted the RemoteDocumentCache.getAll() method that you recently added (but hasn't been ported to web yet). And if I do fix it on web, it may conflict with your porting of that work.

Here's the spec test I wrote (with the intention of adding it to listen_spec.test.ts after the "Ensure correct query results with latency-compensated deletes" test:

  specTest(
    'Ensure correct query results for latency-compensated updates',
    [],
    () => {
      const fullQuery = Query.atPath(path('collection'));
      const filteredQuery = fullQuery.addFilter(filter("match", "==", true));
      const docA = doc('collection/a', 1000, { match: false });
      const docAv2Local = doc('collection/a', 1000, { match: true }, { hasLocalMutations: true });

      return (
        spec()
          .userListens(fullQuery)
          .watchAcksFull(fullQuery, 1000, docA)
          .expectEvents(fullQuery, { added: [docA] })

          // patch docA so that it will now match the filtered query.
          .userPatches("collection/a", {match: true })
          .expectEvents(fullQuery, { modified: [docAv2Local], hasPendingWrites: true })
          // Make sure docA shows up in filtered query.
          .userListens(filteredQuery)
          .expectEvents(filteredQuery, { added: [docAv2Local], fromCache: true,
            hasPendingWrites: true })
      );
    }
  );

NOTE: I verified it fails in the way I expect, but since I haven't fixed the bug can't 100% guarantee it's correct. :-)

Alternatively, I can look at tackling this once you've ported your perf improvements to web. Thanks.

from firebase-android-sdk.

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.