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

GEN-2430 - fix(new-price-calculator): navigation between price calculator pages #4693

Closed
wants to merge 1 commit into from

Conversation

guilhermespopolin
Copy link
Contributor

@guilhermespopolin guilhermespopolin commented Sep 13, 2024

Describe your changes

Fix an issue while navigating between price calculator pages:

Screen.Recording.2024-09-13.at.10.44.25.mov

That happens because currentPriceIntentId was being shared among products.

Copy link

vercel bot commented Sep 13, 2024

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

Name Status Preview Updated (UTC)
hedvig-dot-com ✅ Ready (Inspect) Visit Preview Sep 19, 2024 2:13pm

Copy link

Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @guilhermespopolin and the rest of your teammates on Graphite Graphite

setPriceIntentId(priceIntent.id)
})
const createPriceIntent = () => {
if (createPriceIntentStatus.current !== 'pending') {
Copy link
Contributor Author

@guilhermespopolin guilhermespopolin Sep 13, 2024

Choose a reason for hiding this comment

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

This effect has a long dependency list. This is used to avoid calling createPriceIntent function more than once while there's an ongoing process for creating a price intent. If we call it more than once we'll have an issue where the user sees PurchaseForm on it's fillForm state right before being stuck on the loading state.


export const currentPriceIntentIdAtom = atom(
(get) => {
const priceTemplateName = getAtomValueOrThrow(get, priceTemplateAtom).name
Copy link
Contributor

Choose a reason for hiding this comment

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

I think depending on another singleton atom does not solve the root cause. Can we provide the key via react context, similar to how ProductDataProvider is implemented?

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.

2 participants