Skip to content

Conversation

@lyzno1
Copy link
Contributor

@lyzno1 lyzno1 commented Dec 31, 2025

Summary

This PR integrates @tanstack/eslint-plugin-query to improve code quality and reliability by enforcing React Query best practices. It also resolves multiple exhaustive-deps violations identified in the service/ directory.

Changes

  • Dependency: Added @tanstack/eslint-plugin-query as a dev dependency.
  • Configuration: Updated eslint.config.mjs to enable the flat/recommended rule set.
  • Refactoring: Fixed missing dependencies in queryKey across multiple service hooks to ensure data freshness and correct caching behavior.

Fix Details

Fixed exhaustive-deps errors in the following files by ensuring all external variables used in queryFn are included in the queryKey:

  • service/use-apps.ts
  • service/use-explore.ts
  • service/use-models.ts
  • service/use-pipeline.ts
  • service/use-plugins.ts
  • service/knowledge/use-segment.ts
  • service/access-control.ts
  • service/knowledge/use-document.ts
  • app/components/goto-anything/index.tsx

Related Issue

Closes #30443

Copilot AI review requested due to automatic review settings December 31, 2025 16:00
@lyzno1 lyzno1 requested a review from iamjoel as a code owner December 31, 2025 16:00
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. dependencies Pull requests that update a dependency file labels Dec 31, 2025
@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 focuses on improving the codebase's quality and maintainability by introducing a dedicated ESLint plugin for React Query. This integration helps enforce best practices for data fetching and caching. Concurrently, it addresses and rectifies existing linting issues related to missing dependencies in queryKey arrays within several service layer files, ensuring more robust and predictable data management.

Highlights

  • ESLint Plugin Integration: Integrated @tanstack/eslint-plugin-query to enforce best practices for React Query usage, enhancing code quality and reliability.
  • Lint Error Resolution: Resolved multiple exhaustive-deps violations within the service/ directory by ensuring all external variables used in queryFn are correctly included in the queryKey arrays.
  • Improved Query Key Management: Refactored queryKey definitions across various service hooks to ensure proper dependency tracking, leading to more accurate data freshness and caching behavior.

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

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 integrates @tanstack/eslint-plugin-query and resolves several exhaustive-deps linting errors across various service hooks. The changes correctly update queryKeys to include all dependencies from the queryFn, which is great for data consistency. However, some of the fixes, particularly those involving spreading objects into the queryKey (e.g., { ...params }), introduce potential performance issues by creating new object references on every render. This can lead to unnecessary query refetches. I've added specific comments with suggestions to improve query key stability and prevent these performance problems.

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 integrates @tanstack/eslint-plugin-query to enforce React Query best practices and resolves exhaustive-deps violations in service hooks by ensuring queryKey arrays include all variables used in queryFn.

Key Changes:

  • Added @tanstack/eslint-plugin-query v5.91.2 as a dev dependency and enabled the flat/recommended configuration
  • Updated queryKey arrays across 8 service files to include all external variables referenced in queryFn
  • Fixed cache key inconsistencies to ensure proper data freshness and invalidation behavior

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
web/package.json Added @tanstack/eslint-plugin-query dev dependency
web/pnpm-lock.yaml Updated lock file with new plugin and transitive dependency version updates
web/eslint.config.mjs Imported and enabled the query plugin's flat/recommended rule set
web/service/use-plugins.ts Updated queryKey to include full currentProvider object and normalized file name
web/service/use-pipeline.ts Changed queryKey to include full params object instead of individual properties
web/service/use-models.ts Added missing configFrom parameter to queryKey
web/service/use-explore.ts Added systemFeatures.webapp_auth.enabled to queryKey
web/service/use-apps.ts Wrapped params in object literal with spread operator for two statistics queries
web/service/knowledge/use-segment.ts Changed queryKey to spread params in object literal for segment and child segment lists
web/service/knowledge/use-document.ts Added params to queryKey in document list, detail, and metadata queries
web/service/access-control.ts Added systemFeatures.webapp_auth.enabled and isInstalledApp to queryKey
Files not reviewed (1)
  • web/pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@lyzno1
Copy link
Contributor Author

lyzno1 commented Dec 31, 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 successfully integrates @tanstack/eslint-plugin-query and addresses several exhaustive-deps linting errors across the service layer. The changes correctly add missing dependencies to queryKey arrays in various useQuery hooks.

However, I've identified a couple of instances where the fix, while satisfying the linter, introduces potential performance issues by using unstable object references in queryKey. This can lead to unnecessary data refetching. I've left specific comments with suggestions to improve the stability of these query keys while still adhering to the exhaustive-deps rule.

Overall, this is a valuable cleanup, and with the suggested adjustments, it will be a solid improvement to the codebase's reliability and performance.

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

Labels

dependencies Pull requests that update a dependency file size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Chore: Integrate @tanstack/eslint-plugin-query to enforce React Query best practices

2 participants