Skip to content

Conversation

@DanielSchiavini
Copy link
Collaborator

@DanielSchiavini DanielSchiavini commented May 21, 2025

  • disclaimer page was reloading every time a tab was switched
  • intercept the nextjs click and change the URL directly instead (see next docs)
  • For reviewing it is useful to hide the whitespaces

image

@vercel
Copy link

vercel bot commented May 21, 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 22, 2025 8:46am
curve-dapp-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 22, 2025 8:46am

@DanielSchiavini DanielSchiavini marked this pull request as ready for review May 22, 2025 08:42
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 addresses the issue of the disclaimer page reloading when a tab is switched by intercepting the Next.js click event and using the native history API to modify the URL.

  • Replaces the "tab" prop with "defaultTab" in Disclaimer.tsx and derives the active tab from the URL search parameters.
  • Adjusts TabsSwitcher and the various Disclaimer page files (lend, dex, dao, crvusd) to use the new defaultTab prop and removes unnecessary searchParams spread.
  • Introduces a utility (pushSearchParams) to update query parameters without triggering a full refresh.

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/curve-ui-kit/src/widgets/Disclaimer/Disclaimer.tsx Changed prop name to defaultTab; uses useSearchParams to override defaultTab if provided.
packages/curve-ui-kit/src/utils/urls.ts Added pushSearchParams utility to update URL search parameters gracefully.
packages/curve-ui-kit/src/shared/ui/TabsSwitcher.tsx Updated mapping of option properties to improve clarity and consistency with the new API.
apps/main/src/app/lend/[network]/disclaimer/page.tsx Updated to use defaultTab prop; removed searchParams spread.
apps/main/src/app/dex/[network]/disclaimer/page.tsx Updated to use defaultTab prop; removed searchParams spread.
apps/main/src/app/dao/[network]/disclaimer/page.tsx Updated to use defaultTab prop; removed searchParams spread.
apps/main/src/app/crvusd/[network]/disclaimer/page.tsx Updated to use defaultTab prop; removed searchParams spread.

@DanielSchiavini DanielSchiavini merged commit daff2f4 into main May 22, 2025
11 checks passed
@DanielSchiavini DanielSchiavini deleted the fix/disclaimer branch May 22, 2025 12:26
0xAlunara pushed a commit that referenced this pull request May 22, 2025
This reverts commit daff2f4, reversing
changes made to 55aa6a4.
0xAlunara added a commit that referenced this pull request May 22, 2025
Revert "Merge pull request #972 from curvefi/fix/disclaimer"
DanielSchiavini added a commit that referenced this pull request May 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants