-
Notifications
You must be signed in to change notification settings - Fork 115
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
[txns] Fix navigation in transactions with back #965
Conversation
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.
Thank you for the before and after, and for contributing!
src/pages/Transactions/Index.tsx
Outdated
useEffect(() => { | ||
if (userTxnOnly) { | ||
if (isGraphqlClientSupported && !searchParams.get("type")) { | ||
searchParams.set("type", "user"); | ||
return setSearchParams(searchParams, {replace: true}); | ||
} | ||
|
||
if (!isGraphqlClientSupported && !searchParams.get("type")) { | ||
searchParams.set("type", "all"); | ||
return setSearchParams(searchParams, {replace: true}); | ||
} | ||
}, [isGraphqlClientSupported, searchParams, setSearchParams, allTxnOnly]); |
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 a touch of cleanup here:
- Looks like we no longer need
allTxnOnly
so we can omit it from the dependency array - You should only return a cleanup function from
useEffect
, otherwise, avoid returns.
I suggest the following:
useEffect(() => {
if (!searchParams.get("type")) {
searchParams.set("type", isGraphqlClientSupported ? "user" : "all");
setSearchParams(searchParams, { replace: true });
}
}, [isGraphqlClientSupported, searchParams, setSearchParams]);
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.
Looks correct and simpler, added changes to pull request
Thank you for review
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.
Excelent, thank you!
Hello!
Fix back navigation in transactions page
For the first navigation to transactions, a replacement is used so that you can exit with one click
Navigations between user and all transactions work as usual
Before:
Screen.Recording.2024-12-20.at.12.24.25.mov
After
Screen.Recording.2024-12-20.at.12.39.39.mov
Thanks!