-
Notifications
You must be signed in to change notification settings - Fork 45
fix: disclaimer tabs reloading the page #2 #981
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
Conversation
DanielSchiavini
commented
May 23, 2025
- reapplies fix: disclaimer tabs reloading the page #972, thus reverting Revert "Merge pull request #972 from curvefi/fix/disclaimer" #977
- fixes the bug on the header navigation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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.
Pull Request Overview
This PR reverts a previous change and reapplies an earlier implementation to fix the bug where disclaimer tabs are reloading the page, as well as addressing header navigation issues.
- Reverts changes from PR #977 and reapplies the logic from PR #972
- Updates the Disclaimer component to use a "defaultTab" prop and computes tabs with client-side navigation without reloading
- Adjusts TabsSwitcher and URL manipulation logic to support the new behavior
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/curve-ui-kit/src/widgets/Disclaimer/Disclaimer.tsx | Updated prop naming and logic to derive the active tab from search parameters with a fallback |
| packages/curve-ui-kit/src/utils/urls.ts | Introduced a helper function to update URL query params without triggering a full refresh |
| packages/curve-ui-kit/src/shared/ui/TabsSwitcher.tsx | Refactored to receive computed hrefs instead of deriving them internally |
| apps/main/src/app/*/disclaimer/page.tsx | Updated pages to pass the new "defaultTab" prop to the Disclaimer component |
Comments suppressed due to low confidence (3)
packages/curve-ui-kit/src/widgets/Disclaimer/Disclaimer.tsx:28
- The prop name was changed from 'tab' to 'defaultTab' for clarity. Please ensure that this naming convention is consistently documented and communicated to upstream consumers of this component.
export type DisclaimerProps = { defaultTab: DisclaimerTabId; network: string }
packages/curve-ui-kit/src/shared/ui/TabsSwitcher.tsx:52
- [nitpick] Since the internal use of usePathname has been removed, the parent component is now responsible for providing the correct href value. Double-check that these computed hrefs correctly reflect changes in the current pathname to avoid broken links.
component={Link} href={/* provided externally via computed option.hreft */}
packages/curve-ui-kit/src/widgets/Disclaimer/Disclaimer.tsx:32
- [nitpick] Using the fallback value from 'defaultTab' when the search param 'tab' is absent is a good approach. Verify that the type returned by useSearchParams()?.get('tab') always aligns with the expected DisclaimerTabId to avoid potential runtime mismatches.
const tab = useSearchParams()?.get('tab') ?? defaultTab