Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manually update the ferry data #596

Open
simplenotezy opened this issue Apr 12, 2024 · 1 comment
Open

Manually update the ferry data #596

simplenotezy opened this issue Apr 12, 2024 · 1 comment

Comments

@simplenotezy
Copy link

Let's say you have a normal query (https://ferrygraphql.com/docs/queries) but you wish to programatically update the data, depending on some other logic; how can this be done?

Or even build a request with som predefined data / set the cache with some predefined data?

The issue is that I have a query to fetch all genres, and for each genre, there's 10 movies. When you scroll further in the movie list, I need to load 10 more movies (but not 10 more genres).

One way to achieve this would be to have a query to fetch movies for a genre; and when you fetch the genres list, the cache for the queries to fetch movies is set to the data from the genres query.

@knaeckeKami
Copy link
Collaborator

Yes, there are multiple points where you could hook in.
I'm not sure what your schema and queries look like, so it's difficult to give concrete advice.

But general pointers are:
The .request() method returns a stream, and the stream keeps listening to cache updates.

So you can

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants