-
Notifications
You must be signed in to change notification settings - Fork 362
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
Conversation
The latest updates on your projects. Learn more about Vercel for Git βοΈ 4 Skipped Deployments
|
There was a problem hiding this 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")) { |
There was a problem hiding this comment.
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
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
There was a problem hiding this comment.
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
* fix: check if returnTo is defined * chore: add changeset * chore: accept suggestion
fix: check if returnTo is defined (#8516) * fix: check if returnTo is defined * chore: add changeset * chore: accept suggestion
β Checklist
npx changeset
was attached.π 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
π§ Checklist for the PR Reviewers