Skip to content

Conversation

@lyzno1
Copy link
Contributor

@lyzno1 lyzno1 commented Dec 30, 2025

Summary

  • migrate query-param state to nuqs in app logs, embedded chatbot, partner stack, document list, and sign-in
  • restore legacy pagination / limit normalization and URL sanitization for document list
  • keep behavior aligned with previous URL-driven flows

Files Touched

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @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 next/navigation's useSearchParams to the nuqs library, the change aims to standardize and streamline query parameter management. It also ensures that critical legacy behaviors, such as pagination normalization and URL sanitization for the document list, are preserved, maintaining consistency with previous URL-driven flows.

Highlights

  • Migration to nuqs Library: The core change involves migrating URL query parameter management from next/navigation hooks to the nuqs library across multiple components, including app logs, embedded chatbot, partner stack, document list, and sign-in page.
  • Preservation of Legacy Behavior: Existing behaviors such as pagination normalization, limit handling, and URL sanitization (especially for the document list) have been carefully preserved to ensure consistency with previous URL-driven flows.
  • Standardized Query State Management: The refactor standardizes how query parameters are read, updated, and reset, leading to a more declarative and predictable approach to managing URL-driven application state.

🧠 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 Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@lyzno1 lyzno1 changed the title Refactor query params to nuqs with legacy behavior refactor: query params to nuqs with legacy behavior Dec 30, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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.

@lyzno1 lyzno1 marked this pull request as ready for review December 30, 2025 05:22
Copilot AI review requested due to automatic review settings December 30, 2025 05:22
@lyzno1 lyzno1 requested a review from JzoNgKVO as a code owner December 30, 2025 05:22
@dosubot dosubot bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label Dec 30, 2025
@lyzno1
Copy link
Contributor Author

lyzno1 commented Dec 30, 2025

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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.

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 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 URLSearchParams handling with nuqs hooks (useQueryState and useQueryStates)
  • 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor query params to nuqs and preserve legacy behavior

2 participants