-
Notifications
You must be signed in to change notification settings - Fork 0
[ADE-215] fix stale data in the app #142
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
Conversation
…onsistency across reports and chat functionalities
…treamline mutation handling
…d readability and maintainability
…roved clarity and consistency
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 PR improves code consistency and maintainability by refactoring query keys into a centralized enum, introducing a new hook for toggling report bookmarks, and enhancing cache invalidation across multiple report-related pages.
- Refactors query keys using the new QueryKey enum.
- Implements the useToggleReportBookmark hook to encapsulate bookmark toggling and cache updating logic.
- Updates several components and services to adopt these centralized changes.
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/src/pages/Reports/ReportsListPage.tsx | Replaces inline bookmark toggle logic with useToggleReportBookmark hook and updates query keys. |
| frontend/src/pages/Reports/ReportDetailPage.tsx | Uses QueryKey enum for queries, updates query invalidation, and streamlines UploadModal behavior. |
| frontend/src/pages/Processing/ProcessingPage.tsx | Incorporates QueryKey enum and consistent cache invalidation patterns. |
| frontend/src/pages/Home/HomePage.tsx | Switches to useToggleReportBookmark hook and removes redundant local logic. |
| frontend/src/common/utils/constants.ts | Adds new QueryKey enum entries for Chat and report-related queries. |
| frontend/src/common/hooks/useReports.ts | Refactors query keys and introduces useToggleReportBookmark hook. |
| frontend/src/common/hooks/useChat.ts | Updates query key usage using the new QueryKey enum. |
| backend/src/services/perplexity.service.ts | Adjusts import path for LabValue to use a relative path consistent with the structure. |
Change
This pull request introduces several changes to improve code maintainability and consistency, focusing on refactoring query keys into a centralized
QueryKeyenum, updating query-related logic, and enhancing the functionality of report-related features. The most significant changes include replacing hardcoded query keys withQueryKeyconstants, adding a newuseToggleReportBookmarkhook, and updating various components to use these improvements.Refactoring Query Keys:
QueryKeyenum infrontend/src/common/utils/constants.tsto ensure consistency and reduce duplication. This affects multiple files, includinguseChat.ts,useReports.ts, and several page components. [1] [2] [3] [4] [5]Report Bookmarking Enhancements:
useToggleReportBookmarkhook inuseReports.tsto encapsulate the logic for toggling the bookmark status of reports and updating relevant caches. This replaces the inline bookmark toggling logic previously scattered across components.HomePage.tsx,ReportsListPage.tsx, andReportDetailPage.tsxto use the newuseToggleReportBookmarkhook, simplifying the components and ensuring consistent cache updates. [1] [2] [3]Query Cache Management:
Reports,LatestReports, andReportDetail) in multiple components, ensuring that changes (e.g., toggling bookmarks, deleting reports) are properly reflected across the app. [1] [2] [3]Minor Refactoring:
perplexity.service.ts.HomePage.tsxto use theonClosecallback for theUploadModalcomponent, improving its behavior.These changes collectively improve the maintainability, readability, and functionality of the codebase.
Does this PR introduce a breaking change?
{...}
What needs to be documented once your changes are merged?
{...}
Additional Comments
{...}