From de28f739caa6cc5ea82674128d35e62212354e86 Mon Sep 17 00:00:00 2001 From: George Gritsouk <989898+gggritso@users.noreply.github.com> Date: Fri, 7 Nov 2025 15:37:26 -0500 Subject: [PATCH 1/3] Fix incorrect condition Why is it checking `router` if it passes `navigate` to the constructor? --- static/app/views/dashboards/detail.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/app/views/dashboards/detail.tsx b/static/app/views/dashboards/detail.tsx index c667ac11c941f5..e5ec62539142f1 100644 --- a/static/app/views/dashboards/detail.tsx +++ b/static/app/views/dashboards/detail.tsx @@ -227,7 +227,7 @@ class DashboardDetail extends Component { if ( prevProps.organization !== this.props.organization || prevProps.location !== this.props.location || - prevProps.router !== this.props.router || + prevProps.navigate !== this.props.navigate || prevProps.dashboard !== this.props.dashboard ) { this.setState({ From c5a328effb4d9de983bf14dc59095e3a59c63a1e Mon Sep 17 00:00:00 2001 From: George Gritsouk <989898+gggritso@users.noreply.github.com> Date: Fri, 7 Nov 2025 15:40:56 -0500 Subject: [PATCH 2/3] Narrow down the comparison --- static/app/views/dashboards/detail.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/static/app/views/dashboards/detail.tsx b/static/app/views/dashboards/detail.tsx index e5ec62539142f1..09a942f04f077d 100644 --- a/static/app/views/dashboards/detail.tsx +++ b/static/app/views/dashboards/detail.tsx @@ -226,7 +226,8 @@ class DashboardDetail extends Component { if ( prevProps.organization !== this.props.organization || - prevProps.location !== this.props.location || + prevProps.location.query.unselectedSeries !== + this.props.location.query.unselectedSeries || prevProps.navigate !== this.props.navigate || prevProps.dashboard !== this.props.dashboard ) { From 165657800a417a7741f6ec8e241bd68387f6a149 Mon Sep 17 00:00:00 2001 From: George Gritsouk <989898+gggritso@users.noreply.github.com> Date: Fri, 7 Nov 2025 15:41:51 -0500 Subject: [PATCH 3/3] Add docs --- static/app/views/dashboards/detail.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/static/app/views/dashboards/detail.tsx b/static/app/views/dashboards/detail.tsx index 09a942f04f077d..c9ec02c8b97223 100644 --- a/static/app/views/dashboards/detail.tsx +++ b/static/app/views/dashboards/detail.tsx @@ -226,6 +226,10 @@ class DashboardDetail extends Component { if ( prevProps.organization !== this.props.organization || + // The only part of `location` used by `WidgetLegendSelectionState` is + // `unselectedSeries`. Don't bother comparing anything else. Once this + // component is a functional component, we'll move the selection state + // into a hook, and make sure it doesn't re-render too much. prevProps.location.query.unselectedSeries !== this.props.location.query.unselectedSeries || prevProps.navigate !== this.props.navigate ||