Skip to content

Conversation

@DanielSchiavini
Copy link
Collaborator

@vercel
Copy link

vercel bot commented May 23, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
curve-dapp ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 23, 2025 0:56am
curve-dapp-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 23, 2025 0:56am

@DanielSchiavini DanielSchiavini changed the title Fix/disclaimer fix: disclaimer tabs reloading the page #2 May 23, 2025
@DanielSchiavini DanielSchiavini marked this pull request as ready for review May 23, 2025 13:37
Copy link
Contributor

Copilot AI left a 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

@DanielSchiavini DanielSchiavini merged commit ed1bc19 into main May 26, 2025
11 checks passed
@DanielSchiavini DanielSchiavini deleted the fix/disclaimer branch May 26, 2025 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants