Skip to content

feat(server-routes): implement persisting input values in localStorage#545

Merged
antfu merged 3 commits intomainfrom
feat/sr-inputs-localstorage
Dec 27, 2023
Merged

feat(server-routes): implement persisting input values in localStorage#545
antfu merged 3 commits intomainfrom
feat/sr-inputs-localstorage

Conversation

@arashsheyda
Copy link
Copy Markdown
Member

Screen.Recording.2023-12-16.at.9.10.16.PM.mov

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Dec 17, 2023

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 6a759d0
Status: ✅  Deploy successful!
Preview URL: https://2e6a691a.nuxt-devtools.pages.dev
Branch Preview URL: https://feat-sr-inputs-localstorage.nuxt-devtools.pages.dev

View logs

@atinux
Copy link
Copy Markdown
Member

atinux commented Dec 18, 2023

Shall we also remember the active tab for each route?

@arashsheyda
Copy link
Copy Markdown
Member Author

@atinux For sure!

@atinux
Copy link
Copy Markdown
Member

atinux commented Dec 20, 2023

Looks good to me! I let @antfu do the final review

})

const savedRouteInputs = useLocalStorage<{ path: string, tab: string, inputs: any }[]>('nuxt-devtools:server-routes:inputs', () => [], {
window: window.parent,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is there a reason to pass the parent window here? It should work with iframe window as they are same origin.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

While trying out with my laptop(windows 10), the storage wasn't working as expected(the client would get reset after a page refresh)
Is it possible for you to test it out?

@antfu antfu merged commit 67dbf65 into main Dec 27, 2023
@antfu antfu deleted the feat/sr-inputs-localstorage branch December 27, 2023 14:37
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