Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

fix: prevent URL update to /insights/false on navigation without context (#1884) (#1913)

Hammad Hassane4ee1585abd4
diff --git a/ui/app/manager/src/pages/page-insights.ts b/ui/app/manager/src/pages/page-insights.ts
index 0cc5f12d6..08a9f6eac 100644
--- a/ui/app/manager/src/pages/page-insights.ts
+++ b/ui/app/manager/src/pages/page-insights.ts
@@ -127,9 +127,13 @@ export class PageInsights extends Page<AppStateKeyed> {
}
protected _updateRoute(silent: boolean = true) {
- router.navigate(getInsightsRoute(this._editMode, this._dashboardId), {
- callHooks: !silent,
- callHandler: !silent
- });
+ // This if condition prevents updating the URL to /insights/false when no edit mode or dashboard is selected.
+ // This avoids polluting the browser history and ensures users don't get redirected to Insights on refresh.
+ if (this._editMode || this._dashboardId) {
+ router.navigate(getInsightsRoute(this._editMode, this._dashboardId), {
+ callHooks: !silent,
+ callHandler: !silent
+ });
+ }
}
}