We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e9e5bb9 commit 382a22cCopy full SHA for 382a22c
frontend/src/common/hooks/useReports.ts
@@ -92,12 +92,8 @@ export const useToggleReportBookmark = () => {
92
93
// Update the bookmark status in the report detail page
94
queryClient.setQueryData<MedicalReport | undefined>(
95
- [QueryKey.ReportDetail, reportId],
96
- (oldReport) => {
97
- if (!oldReport) return undefined;
98
- if (oldReport.id !== updatedReport.id) return oldReport;
99
- return { ...oldReport, bookmarked: updatedReport.bookmarked };
100
- },
+ [QueryKey.ReportDetail, updatedReport.id],
+ (report) => (report?.id === updatedReport.id ? updatedReport : report),
101
);
102
},
103
});
0 commit comments