Git Product home page Git Product logo

Comments (6)

smkhalsa avatar smkhalsa commented on May 17, 2024 1

Ok, this issue should be fixed in the latest version.

You can set a dependency_override on rxdart for the beta version.

from ferry.

smkhalsa avatar smkhalsa commented on May 17, 2024

To handle pagination, you need to specify an updateResult callback, not an UpdateCacheHandler. Take another look at the docs.

Also, a few notes:

  1. Results will only be updated if the request has the same requestId. If no requestId is specified, a unique ID will be generated automatically. If you're using Flutter, make sure you either instantiate the request outside of the build() method (so that it doesn't get instantiated on every build with a new ID) or explicitly provide an ID.
  2. Ferry doesn't have any way of knowing that a getItem(id) query should return one of the results previously returned by
    a getItems() query. You can specify a FieldPolicy.read() function on the getItems field of your Query Typepolicy to allow for this behavior, but working with TypePolicies and FieldPolicies is not yet well documented. (although this functionality closely mirrors Apollo's use of TypePolicies, so their docs on this topic could provide you some guidance).

from ferry.

agent3bood avatar agent3bood commented on May 17, 2024

Thanks @smkhalsa for explaining this to me, I am aware of updateResult function and I am using it.
Maybe I did not explain the issue clearly, here are steps I am doing

  1. getItems(limit = 10, offset = 0) this function will keep listening to the result items
  2. I do update an item at index between 0 and 10 using a mutation request and I do update the item fragment using writeFragment()
  3. The listener from step 1 will get a new event with the updated fragment from cache and then from server.
  4. I do the pagination process as in the docs, rebuild the request and add it to the requestController updateResult is called to add the new items to the previous, and then the listener from step 1 called with the new list.
  5. If I update an item indexed 10 to 20 (using writeFragment) the listener from step 1 is called; but if I update an item indexed 0 to 10 the listener from step ` is NOT called which is an issue form me.
    I want to know the behavior is step 5 is expected or is it a bug?

Thanks again for the answer and this great library

from ferry.

smkhalsa avatar smkhalsa commented on May 17, 2024

Are you using the latest version of ferry (0.8.0)?

from ferry.

agent3bood avatar agent3bood commented on May 17, 2024

No, I am using ferry: ^0.7.6 I could not upgrade because of the rxdart version.
Is it possible to make the rxdart version as a range
something like rxdart: ">=2.0.0 <3.0.0"

from ferry.

agent3bood avatar agent3bood commented on May 17, 2024

Thanks, it is working fine after the upgrade.

from ferry.

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.