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

(graphcache) - Fix offline queries not flowing through the entire cacheExchange #1011

Merged
merged 3 commits into from
Sep 29, 2020

Conversation

kitten
Copy link
Member

@kitten kitten commented Sep 29, 2020

Test against: https://codesandbox.io/s/urql-crud-router-doesnt-update-forked-3nf19

This change updates when queries that have received an offline / network error are dispatched as cache-only operations again, and adds support for them being retried automatically (in case they're still active) when the client comes back online.

A small change has also been made to @urql/core to allow client.reexecuteOperation to be called with mutations.

@kitten kitten requested a review from JoviDeCroock September 29, 2020 14:14
@changeset-bot
Copy link

changeset-bot bot commented Sep 29, 2020

🦋 Changeset detected

Latest commit: 301c590

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@kitten
Copy link
Member Author

kitten commented Sep 29, 2020

Tested against: https://codesandbox.io/s/urql-crud-router-doesnt-update-forked-7c622?file=/src/urql.js

Working as intended! The todos page starts fetching and receives an empty result with the passed operation as expected.

Screenshot 2020-09-29 at 16 17 20

@kitten kitten merged commit e55f275 into main Sep 29, 2020
@kitten kitten deleted the fix/offline-query-fallback branch September 29, 2020 16:24
@frederikhors
Copy link
Contributor

@urql/svelte is not working because I think @urql/core is not updated to latest one.

Am I wrong?

@kitten
Copy link
Member Author

kitten commented Sep 29, 2020

@frederikhors If you've upgraded @urql/exchange-graphcache then you'll need to upgrade @urql/core. It may now also be duplicated, so just bump its version or check the lockfile and bump it there.

@frederikhors
Copy link
Contributor

frederikhors commented Sep 29, 2020

I tried. Also with @urql/core 1.13.1 it doesn't work.

I'll update my CodeSandBox reproduction now and I will post it here or where you want.

@frederikhors
Copy link
Contributor

Also in the Preact reproduction on CodeSandBox only updating:

  1. @urql/exchange-graphcache from 3.1.1 to 3.1.2 and

  2. @urql/core to 1.13.1

doesn't fix.

So I think with Svelte is the same: only upgrading @urql/exchange-graphcache to 3.1.2 and @urql/core to 1.13.1 is not enough.

Something in @urql is changed that doesn't work anymore with @urql/svelte today.

@frederikhors
Copy link
Contributor

frederikhors commented Sep 29, 2020

Here the broken reproduction with Svelte today: https://codesandbox.io/s/urql-svelte-crud-offline-fetching-stale-data-rj22w.

If you wish I can open an issue.

@kitten
Copy link
Member Author

kitten commented Sep 29, 2020

@frederikhors ive got a fixed up sandbox in the original issue that's been tested to work.
I'm afraid any discrepancy here may be that the expected behaviour or conditions are flawed in the first place?

I think with Svelte we'll need to focus on new bindings. There's too many things that can break, be misused, or are buggy in the state that they're in.

@frederikhors
Copy link
Contributor

ive got a fixed up sandbox in the original issue that's been tested to work.

Yep because you updated @urql/preact too. This is what I'm saying. Svelte is broken today.

However, I'm very tired of all this.

Maybe I'll leave Svelte and I'll use Vue with Apollo.

We'll see.

It has been a great adventure with you so far, but I feel I bother you a lot every time.

Thanks for everything.

@kitten
Copy link
Member Author

kitten commented Sep 29, 2020

@frederikhors that's alright; that said though, @urql/preact is now expected to work but it'll take #1007 for @urql/svelte's issues to be ironed out; although we do have a good list of issues with it now

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

Successfully merging this pull request may close these issues.

3 participants