Skip to content

data returning { force: true } #637

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

Closed
Javo-blip opened this issue Sep 6, 2020 · 5 comments · Fixed by #1096
Closed

data returning { force: true } #637

Javo-blip opened this issue Sep 6, 2020 · 5 comments · Fixed by #1096

Comments

@Javo-blip
Copy link

Bug report

Description / Observed Behaviour

Sometimes the data that is returned from the useSWR hook is a { force: true }
This seems to be caused by the cache value being set to { force: true } to trigger a re-validate? It's only happened since v0.3.x

Expected Behaviour

data should either return undefined or actual returned data from fetcher

@ChrisLincoln
Copy link

I had useSWR returning "false" in data, plus it was just not performing its function in life. Turns out I had bad usage of a mutate() call in a websocket event.

I had

mutate('somekey', false)
//instead of
mutate('somekey', undefined, false).

I actually wanted mutate('somekey', undefined, true), but that isn't relevant.

@Javo-blip
Copy link
Author

Just using

mutate('somekey')

should be intended usage according to documentation though?

This error has only occurred after upgrading to v0.3 and when useSWRInfinite was being used

@shuding
Copy link
Member

shuding commented Sep 20, 2020

Can you provide a reproduction?

@pke
Copy link

pke commented Mar 24, 2021

Encountered the same today! Where might it come from?

@shuding shuding mentioned this issue Apr 4, 2021
@pke
Copy link

pke commented Apr 4, 2021

Thanks for the fix

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 a pull request may close this issue.

4 participants