Skip to content

PaymentPage: Fix localStorage access issue in incognito#4922

Merged
kodiakhq[bot] merged 3 commits into
mainfrom
hotfix/payment-localstorage
Oct 10, 2022
Merged

PaymentPage: Fix localStorage access issue in incognito#4922
kodiakhq[bot] merged 3 commits into
mainfrom
hotfix/payment-localstorage

Conversation

@hariombalhara
Copy link
Copy Markdown
Member

@hariombalhara hariombalhara commented Oct 10, 2022

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

  • Bug fix (non-breaking change which fixes an issue)
  • Chore (refactoring code, technical debt, workflow improvements)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

@vercel
Copy link
Copy Markdown

vercel Bot commented Oct 10, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
cal ✅ Ready (Inspect) Visit Preview Oct 10, 2022 at 8:09AM (UTC)

@hariombalhara hariombalhara requested review from a team and alishaz-polymath October 10, 2022 07:56
Copy link
Copy Markdown
Member Author

@hariombalhara hariombalhara left a comment

Choose a reason for hiding this comment

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

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);
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.

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>
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.

localStorage can't be accessed server side.

user,
eventType,
booking,
trpcState: ssr.dehydrate(),
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.

Does translation server side.

@hariombalhara hariombalhara added ♻️ autoupdate tells kodiak to keep this branch up-to-date automerge labels Oct 10, 2022
Copy link
Copy Markdown
Member

@alishaz-polymath alishaz-polymath left a comment

Choose a reason for hiding this comment

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

🚀

@kodiakhq kodiakhq Bot merged commit f164724 into main Oct 10, 2022
@kodiakhq kodiakhq Bot deleted the hotfix/payment-localstorage branch October 10, 2022 08:11
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 PeerRich added the core area: core, team members only label Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automerge ♻️ autoupdate tells kodiak to keep this branch up-to-date core area: core, team members only

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants