From a84fb3dae18fe3b40add8a22c6016f2a831d8690 Mon Sep 17 00:00:00 2001 From: Trevin Chow Date: Tue, 7 Apr 2026 09:37:43 -0700 Subject: [PATCH] Fix custom report editor retaining unsaved settings (#7356) * Fix custom report editor retaining unsaved settings The session storage clear condition only fired when navigating from the /reports dashboard. Since the URL tracking runs inside the report component, the stored URL always pointed to the last report path, so revisiting the same report never triggered the clear. Changed the condition to clear session storage whenever the stored URL differs from the current path. This handles navigating from the dashboard, from another report, or any other page. Fixes #7332 * Add release notes for PR #7356 --- .../src/components/reports/reports/CustomReport.tsx | 2 +- upcoming-release-notes/7356.md | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 upcoming-release-notes/7356.md diff --git a/packages/desktop-client/src/components/reports/reports/CustomReport.tsx b/packages/desktop-client/src/components/reports/reports/CustomReport.tsx index 8550947257..ad6b84f2ab 100644 --- a/packages/desktop-client/src/components/reports/reports/CustomReport.tsx +++ b/packages/desktop-client/src/components/reports/reports/CustomReport.tsx @@ -183,7 +183,7 @@ function CustomReportInner({ sessionStorage.setItem('prevUrl', prevUrl); sessionStorage.setItem('url', location.pathname); - if (['/reports'].includes(prevUrl)) sessionStorage.clear(); + if (prevUrl !== location.pathname) sessionStorage.clear(); const reportFromSessionStorage = sessionStorage.getItem('report'); const session: Partial = reportFromSessionStorage diff --git a/upcoming-release-notes/7356.md b/upcoming-release-notes/7356.md new file mode 100644 index 0000000000..e7b446766f --- /dev/null +++ b/upcoming-release-notes/7356.md @@ -0,0 +1,6 @@ +--- +category: Bugfixes +authors: [tmchow] +--- + +Fix custom report editor retaining unsaved settings when navigating between routes.