Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

How to use persistQueryClient? #72

Closed
MaximilianLloyd opened this issue Jan 11, 2023 · 3 comments
Closed

How to use persistQueryClient? #72

MaximilianLloyd opened this issue Jan 11, 2023 · 3 comments

Comments

@MaximilianLloyd
Copy link

Hi. I was wondering how you can use the persistQueryClient functionality with this?

@NetanelBasal
Copy link
Member

As in React, I guess. Provide the function what it needs.

@MaximilianLloyd
Copy link
Author

Ok, this is what i currently have. But it doesn't seem to be working

const queryClient = new QueryClient({
  defaultOptions: {
    queries: {
      staleTime: Infinity,
      refetchOnWindowFocus: false
    }
  }
});

const persister = createSyncStoragePersister({
  storage: window.localStorage,
  serialize: (data) => compress(JSON.stringify(data)),
  deserialize: (data) => JSON.parse(decompress(data))
});

persistQueryClient({ queryClient, persister: persister , maxAge: Infinity });


persistQueryClientRestore({ queryClient, persister: persister });

and

providers: [
    provideQueryClient(queryClient)
]

@NetanelBasal
Copy link
Member

Can you provide a stackblitz, please?

@ngneat ngneat locked and limited conversation to collaborators Jan 21, 2023
@NetanelBasal NetanelBasal converted this issue into discussion #78 Jan 21, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants