Next.js Discord

Discord Forum

LocalStorage issue

Unanswered
Somali posted this in #help-forum
Open in Discord
SomaliOP
Hi, I have a website that runs on Next.js 13 page router.
Flow looks like this:

1. user open a web-site at Facebook internal browser (data from query params saves at localStorage)

2. then user click a button and he redirecting to Chrome browser (same code of saving data from query params runs again)

3. then user downloaded a PWA from this web-site and that data which was in localStorage go to PWA, then another redirect url open with those queries.

Problem is - we look at external logger, and see that not all users have those queries.

Hook which saves queries to localStorage (point 1 and 2 from my description above), it runs on pages/index.js, as useQueryParams (true) at first screenshot.

then this hooks runs at component, which get data from localStorage to PWA at another redirect url.
(point 3 from my description above) at second screenshot.

Maybe problem that PWA has another localStorage ? or this window.location.replace runs without waiting those queries ?

0 Replies