PaymentPage: Fix localStorage access issue in incognito#4922
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
hariombalhara
commented
Oct 10, 2022
Member
Author
hariombalhara
left a comment
There was a problem hiding this comment.
Done with self review
| let embedIframeWidth = 0; | ||
| setDate(date.tz(localStorage.getItem("timeOption.preferredTimeZone") || dayjs.tz.guess())); | ||
| const _timezone = localStorage.getItem("timeOption.preferredTimeZone") || dayjs.tz.guess(); | ||
| setTimezone(_timezone); |
Member
Author
There was a problem hiding this comment.
Compute timezone on client side only where localStorage is available.
| <span className="text-gray-500"> | ||
| ({localStorage.getItem("timeOption.preferredTimeZone") || dayjs.tz.guess()}) | ||
| </span> | ||
| <span className="text-gray-500">({timezone})</span> |
Member
Author
There was a problem hiding this comment.
localStorage can't be accessed server side.
| user, | ||
| eventType, | ||
| booking, | ||
| trpcState: ssr.dehydrate(), |
Member
Author
There was a problem hiding this comment.
Does translation server side.
hariombalhara
added a commit
that referenced
this pull request
Oct 10, 2022
* localStorage isnt available at server and in incognito mode * Do translation server side for Payment Page
PeerRich
pushed a commit
that referenced
this pull request
Oct 10, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes # (issue)
It is known that localStorage access throws error in third party context when opened in Google Chrome Incognito Mode.
So, use our wrapper of localStorage instead of native one.
Also, payment page is now translated server side, avoiding flash of untranslated content on the page
Environment: Production
Type of change