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

feat: session storage persistor #2282

Merged
merged 3 commits into from
Jun 11, 2021

Conversation

CurtisHughes
Copy link
Contributor

Adds session storage persistor as an experimental feature (mirrors the logic for the local storage persistor).

@vercel
Copy link

vercel bot commented May 14, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/tannerlinsley/react-query/6e3fgweqq64F1mo4EheKCUdVmvQ1
✅ Preview: https://react-query-git-fork-curtishughes-session-1151d9-tannerlinsley.vercel.app

@codesandbox-ci
Copy link

codesandbox-ci bot commented May 14, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit b8057b0:

Sandbox Source
tannerlinsley/react-query: basic Configuration
tannerlinsley/react-query: basic-typescript Configuration

@TkDodo
Copy link
Collaborator

TkDodo commented Jun 4, 2021

Since localstorage and sessionStorage have literally the same api - thee Web Storage API, maybe we should just rename localStoragePersistor to webStoragePersistor and allow to pass in if you want window.localStorage or window.sessionStorage ?

What do you think @tannerlinsley ?

@CurtisHughes
Copy link
Contributor Author

That feels like a clean solution. I can attempt those changes if that is the direction you all want to go.

@TkDodo
Copy link
Collaborator

TkDodo commented Jun 4, 2021

it's experimental so I think we can justify the rename. I think we should add a storage: Storage prop to the createPersistor function, which could then be either window.localStorage, window.sessionStorage or maybe something else that I am not even aware of.

@CurtisHughes
Copy link
Contributor Author

Ok @TkDodo, I took a stab at it. Changed createLocalStoragePersitor -> createWebStoragePersistor and added a required property storage: Storage. Let me know if that looks like what you had in mind.

@TkDodo TkDodo requested a review from tannerlinsley June 10, 2021 20:31
@TkDodo
Copy link
Collaborator

TkDodo commented Jun 10, 2021

I think this looks good 👍 . Let's wait if @tannerlinsley supports the re-name.

Copy link
Collaborator

@tannerlinsley tannerlinsley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯 % approve.

@TkDodo TkDodo merged commit be6bfbb into TanStack:master Jun 11, 2021
@tannerlinsley
Copy link
Collaborator

🎉 This PR is included in version 3.17.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

3 participants