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

♻️ small refactor of router.querys and 🐛 bug solving realted to usePersistent and coupons #1615

Merged

Conversation

lumi-tip
Copy link
Contributor

Issue: #7770

Bug Descriptions:

Bug 1

If a course already has a coupon applied (e.g., summer-25), the system currently allows users to apply the same coupon again, resulting in an additional discount. This behavior is incorrect. Instead, with the fix, the system should display a toast message notifying the user that the coupon has already been applied.

Bug 2

When using a coupon in the URL's query string, it is saved in usePersistent as a string. If a subsequent transaction is attempted, the usePersistent logic triggers and parses the string, causing an exponential duplication issue (e.g., returning /'string'/).

This occurs because JSON.stringify is designed to serialize objects, arrays, and other data types. When applied directly to a simple string (e.g., "summer-25"), it converts the string into a JSON-valid string that includes additional quotes, causing unintended behavior.

Copy link

vercel bot commented Sep 25, 2024

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

Name Status Preview Comments Updated (UTC)
app 🛑 Canceled (Inspect) Oct 1, 2024 4:38pm

@tommygonzaleza tommygonzaleza merged commit d6a94c8 into breatheco-de:development Oct 1, 2024
1 of 2 checks passed
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