refactor(web): drop swr and migrate share/chat hooks to tanstack query#30232
refactor(web): drop swr and migrate share/chat hooks to tanstack query#30232
Conversation
| /gemini summary |
| /gemini review |
Summary of ChangesThis pull request undertakes a significant refactoring effort to standardize the data fetching strategy across the web frontend. It systematically replaces all instances and dependencies on the SWR library with Tanstack Query, particularly within the share and chat functionalities. This migration aims to improve consistency, maintainability, and potentially performance by leveraging Tanstack Query's robust caching and state management capabilities. 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. Changelog
Activity
|
There was a problem hiding this comment.
Code Review
This pull request is a significant and well-executed refactoring that removes the SWR dependency and migrates the share/chat data fetching logic to TanStack Query. The changes are clean, consistent, and follow best practices for using TanStack Query, such as creating custom hooks and centralized query keys. The addition of comprehensive test suites for the new hooks is commendable and greatly improves the robustness of the codebase.
My review focuses on ensuring the new data fetching logic is sound. I've identified a potential issue in the enabled logic within the newly created use-share.ts hooks, which could lead to race conditions and failed API requests. The proposed fixes will make these hooks more robust. Overall, this is an excellent contribution that modernizes the data fetching layer.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 18 out of 19 changed files in this pull request and generated 1 comment.
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.
Summary
Fixes #30230
Screenshots
Checklist
dev/reformat(backend) andcd web && npx lint-staged(frontend) to appease the lint gods