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

If fetcher returns null the revalidation is ignored #27

Open
rauchg opened this issue Nov 21, 2021 · 1 comment
Open

If fetcher returns null the revalidation is ignored #27

rauchg opened this issue Nov 21, 2021 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@rauchg
Copy link

rauchg commented Nov 21, 2021

This was my fetcher function:

  async function readUser() {
    return localStorage.user ?? null;
  }

If I'd go to the console and run localStorage.removeItem('user'), revalidation of any kind (whether via calling revalidate or focus revalidation) wouldn't work, until I switched it to:

  async function readUser() {
    return localStorage.user ?? false;
  }
@ConsoleTVs
Copy link
Owner

Hey Guillermo,

Thanks A LOT for this exhaustive issue reports. I will be looking into them to see if they are related to this lib or https://github.com/ConsoleTVs/swrev.

I think I'll need some testing to be able to do all this, apologies!

Furthermore, I'm really happy to see you testing this tool. I'll keep an eye on all that's been posted around here for the upcoming release and see if I am able to correctly fix the use cases provided.

I know it might be frustrating to see many issues around. My intention was to build a foundation to be used across frameworks Like Svelte or Vue (You guys already have a great swr library for react). Strangely, I seem to be getting less issues on the Vue adapter (https://github.com/ConsoleTVs/vswr). Perhaps less people using it, no idea.

I am not an expect on Svelte, so I might need some help in some areas. Will investigate, thanks again!

@ConsoleTVs ConsoleTVs added the bug Something isn't working label Nov 21, 2021
@ConsoleTVs ConsoleTVs self-assigned this Nov 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants