-
Notifications
You must be signed in to change notification settings - Fork 19.3k
refactor: query params to nuqs with legacy behavior #30358
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
base: main
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @lyzno1, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refactors the handling of URL query parameters in several parts of the application, including app logs, embedded chatbot, partner stack integration, document lists, and the sign-in page. By migrating from Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request successfully refactors query parameter state management from Next.js's built-in hooks to nuqs across several components. This is a great improvement that simplifies the code and centralizes query state logic. The changes are generally well-executed. I've identified a minor performance regression in use-document-list-query-state.ts where memoization was removed and have provided suggestions to address it. The rest of the changes look solid.
web/app/components/datasets/documents/hooks/use-document-list-query-state.ts
Outdated
Show resolved
Hide resolved
web/app/components/datasets/documents/hooks/use-document-list-query-state.ts
Outdated
Show resolved
Hide resolved
|
/gemini 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.
Code Review
This pull request refactors query parameter management across several components to use the nuqs library, which simplifies state handling and improves code clarity. The changes are well-executed, replacing manual URL parsing and state management with a more robust, hook-based approach. I've identified a couple of minor issues: one potential bug in how the search keyword is passed to a child component, and a performance optimization opportunity in a custom hook by memoizing its return value. Overall, this is a great improvement.
web/app/components/datasets/documents/hooks/use-document-list-query-state.ts
Outdated
Show resolved
Hide resolved
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 pull request migrates query parameter state management from Next.js's useSearchParams and manual URL manipulation to the nuqs library across five components, while preserving legacy behavior for pagination, URL normalization, and validation.
Key changes:
- Replaced manual
URLSearchParamshandling withnuqshooks (useQueryStateanduseQueryStates) - Preserved legacy validation and normalization logic (e.g., page/limit bounds, keyword trimming, status sanitization)
- Maintained backward-compatible URL behavior through default values and conditional parameter inclusion
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
web/app/signin/page.tsx |
Migrated step query parameter from useSearchParams to useQueryState |
web/app/components/billing/partner-stack/use-ps-info.ts |
Migrated ps_partner_key and ps_xid query parameters to useQueryState |
web/app/components/base/chat/embedded-chatbot/hooks.tsx |
Migrated locale parameter from manual URLSearchParams to useQueryState and added to useEffect dependencies |
web/app/components/datasets/documents/hooks/use-document-list-query-state.ts |
Complete refactor from manual URL management to useQueryStates with preserved validation logic for page, limit, keyword, status, and sort |
web/app/components/datasets/documents/hooks/use-document-list-query-state.spec.tsx |
Added comprehensive test suite for query state hook covering defaults, sanitization, updates, and callback stability |
web/app/components/app/log/index.tsx |
Migrated from cached state and manual URL manipulation to useQueryStates with query param normalization |
web/app/components/app/log/index.spec.tsx |
Added test coverage for loading, empty, and data states with query parameter validation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
nuqsin app logs, embedded chatbot, partner stack, document list, and sign-inFiles Touched
web/app/components/app/log/index.tsxweb/app/components/base/chat/embedded-chatbot/hooks.tsxweb/app/components/billing/partner-stack/use-ps-info.tsweb/app/components/datasets/documents/hooks/use-document-list-query-state.tsweb/app/signin/page.tsxFixes Refactor query params to nuqs and preserve legacy behavior #30357