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

fix: check if returnTo is defined #8516

Merged
merged 3 commits into from
Nov 28, 2024
Merged

fix: check if returnTo is defined #8516

merged 3 commits into from
Nov 28, 2024

Conversation

Couto
Copy link
Contributor

@Couto Couto commented Nov 28, 2024

βœ… Checklist

  • npx changeset was attached.
  • Covered by automatic tests.
  • Impact of the changes:
    • ...

πŸ“ Description

Check if returnTo is defined as a string before triggering the swap analytic.
Some sections of the application do not provide a returnTo value.

Screen.Recording.2024-11-28.at.08.57.16.mov

❓ Context

  • JIRA or GitHub link:

🧐 Checklist for the PR Reviewers

  • The code aligns with the requirements described in the linked JIRA or GitHub issue.
  • The PR description clearly documents the changes made and explains any technical trade-offs or design decisions.
  • There are no undocumented trade-offs, technical debt, or maintainability issues.
  • The PR has been tested thoroughly, and any potential edge cases have been considered and handled.
  • Any new dependencies have been justified and documented.
  • Performance considerations have been taken into account. (changes have been profiled or benchmarked if necessary)

@Couto Couto requested a review from a team as a code owner November 28, 2024 09:00
Copy link

vercel bot commented Nov 28, 2024

The latest updates on your projects. Learn more about Vercel for Git β†—οΈŽ

4 Skipped Deployments
Name Status Preview Comments Updated (UTC)
ledger-live-github-bot ⬜️ Ignored (Inspect) Visit Preview Nov 28, 2024 9:07am
native-ui-storybook ⬜️ Ignored (Inspect) Visit Preview Nov 28, 2024 9:07am
react-ui-storybook ⬜️ Ignored (Inspect) Visit Preview Nov 28, 2024 9:07am
web-tools ⬜️ Ignored (Inspect) Visit Preview Nov 28, 2024 9:07am

@live-github-bot live-github-bot bot added the desktop Has changes in LLD label Nov 28, 2024
Justkant
Justkant previously approved these changes Nov 28, 2024
Copy link
Contributor

@Justkant Justkant left a comment

Choose a reason for hiding this comment

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

LGTM, I made another suggestion but it's fine like that

@@ -60,14 +60,15 @@ export function LiveApp({ match, appId: propsAppId, location }: Props) {
}, [search, customDappUrl, urlParams?.customDappUrl, internalParams?.customDappUrl]);

const handleClose = useCallback(() => {
if (returnTo.startsWith("/swap")) {
if (typeof returnTo === "string" && returnTo.startsWith("/swap")) {
Copy link
Contributor

Choose a reason for hiding this comment

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

LGTM like that, another option could have been to simply do that

Suggested change
if (typeof returnTo === "string" && returnTo.startsWith("/swap")) {
if (returnTo?.startsWith("/swap")) {

Also if you update the type in the memo above you can get typescript to show the undefined correctly as shown in the screenshot below
Screenshot 2024-11-28 at 09 21 11

Copy link
Contributor Author

@Couto Couto Nov 28, 2024

Choose a reason for hiding this comment

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

Just pushed this change.
The video in the description is still valid after this commit, according to my tests

@Couto Couto merged commit 6d679f5 into develop Nov 28, 2024
41 checks passed
@Couto Couto deleted the fix/returnTo-undefined branch November 28, 2024 09:28
Couto added a commit that referenced this pull request Nov 28, 2024
* fix: check if returnTo is defined
* chore: add changeset
* chore: accept suggestion
Couto added a commit that referenced this pull request Nov 28, 2024
fix: check if returnTo is defined (#8516)

* fix: check if returnTo is defined
* chore: add changeset
* chore: accept suggestion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
desktop Has changes in LLD
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants