-
Notifications
You must be signed in to change notification settings - Fork 57
Fixes for 7.0.3 #4469
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
Fixes for 7.0.3 #4469
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,6 +12,10 @@ export const useDeepLinkWatcher = () => { | |
| const {isLoggedIn} = useAuth() | ||
| const {pendingAction, setPendingAction} = useLinks() | ||
|
|
||
| // Track URLs that have already been processed to prevent re-processing | ||
| // when processLink callback reference changes | ||
| const processedUrlsRef = React.useRef<Set<string>>(new Set()) | ||
|
|
||
| const processLink = React.useCallback( | ||
| (url: string) => { | ||
| // Try Yoroi links first (yoroi://) | ||
|
|
@@ -70,7 +74,8 @@ export const useDeepLinkWatcher = () => { | |
| React.useEffect(() => { | ||
| const getInitialURL = async () => { | ||
| const url = await Linking.getInitialURL() | ||
| if (url !== null) { | ||
| if (url !== null && !processedUrlsRef.current.has(url)) { | ||
| processedUrlsRef.current.add(url) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Initial URL marked processed before processing can failMedium Severity In the "app is closed - check initial URL on mount" effect, the URL is added to |
||
| processLink(url) | ||
| } | ||
| } | ||
|
|
@@ -92,40 +97,42 @@ export const useDeepLinkWatcher = () => { | |
| const checkInitialUrlAfterLogin = async () => { | ||
| const url = await Linking.getInitialURL() | ||
|
|
||
| if (url !== null) { | ||
| // Try both Yoroi and Cardano links | ||
| const parsedYoroiAction = linksYoroiParser(url) | ||
| if (parsedYoroiAction != null) { | ||
| if ( | ||
| parsedYoroiAction.params?.isSandbox === true && | ||
| __DEV__ === false | ||
| ) { | ||
| return | ||
| } | ||
| const pendingAction: PendingAction = { | ||
| source: 'yoroi', | ||
| action: {info: parsedYoroiAction, isTrusted: false}, | ||
| } | ||
| setPendingAction(pendingAction) | ||
| // Skip if URL was already processed | ||
| if (url === null || processedUrlsRef.current.has(url)) { | ||
| return | ||
| } | ||
|
|
||
| // Try both Yoroi and Cardano links | ||
| const parsedYoroiAction = linksYoroiParser(url) | ||
| if (parsedYoroiAction != null) { | ||
| if (parsedYoroiAction.params?.isSandbox === true && __DEV__ === false) { | ||
| return | ||
| } | ||
| processedUrlsRef.current.add(url) | ||
| const pendingAction: PendingAction = { | ||
| source: 'yoroi', | ||
| action: {info: parsedYoroiAction, isTrusted: false}, | ||
| } | ||
| setPendingAction(pendingAction) | ||
| return | ||
| } | ||
|
|
||
| if (isWebCardanoLink(url)) { | ||
| try { | ||
| const cardanoAction = parseCardanoLink(url) | ||
| const pendingAction: PendingAction = { | ||
| source: 'cardano', | ||
| action: cardanoAction, | ||
| } | ||
| setPendingAction(pendingAction) | ||
| } catch (error) { | ||
| logger.error('useDeepLinkWatcher: error parsing URL after login', { | ||
| error, | ||
| errorMessage: | ||
| error instanceof Error ? error.message : String(error), | ||
| url, | ||
| }) | ||
| if (isWebCardanoLink(url)) { | ||
| try { | ||
| processedUrlsRef.current.add(url) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. URL marked processed before parsing can failMedium Severity In |
||
| const cardanoAction = parseCardanoLink(url) | ||
| const pendingAction: PendingAction = { | ||
| source: 'cardano', | ||
| action: cardanoAction, | ||
| } | ||
| setPendingAction(pendingAction) | ||
| } catch (error) { | ||
| logger.error('useDeepLinkWatcher: error parsing URL after login', { | ||
| error, | ||
| errorMessage: | ||
| error instanceof Error ? error.message : String(error), | ||
| url, | ||
| }) | ||
| } | ||
| } | ||
| } | ||
|
|
||


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.
Missing cleanup for processed claims prevents retry
Medium Severity
The
processedClaimUrlsRefSet is never cleared, unlikeActionHandlerwhich clears itsprocessedActionsRefwhenpendingActionbecomes null. Once a claim is added to this Set, it cannot be re-triggered during the component's lifecycle, even if the claim fails downstream or is cancelled. Users would need to navigate away (unmounting the component) to retry the same claim.