Skip to content

Conversation

@gggritso
Copy link
Member

@gggritso gggritso commented Nov 7, 2025

DashboardDetail is the whole dashboard, so it's expensive to re-render. Right now, when the Widget Builder opens it re-renders twice. One of them is legitimate, because the Widget Builder is now open. One of them is because widgetBuilderSelectionState was re-calculated, which is not needed.

We only need to recalculate the selection state if the URL selection changed. If it did not, skip it, and skip the render. This saves like a 300ms render in some cases.

Before:
Screenshot 2025-11-07 at 3 37 09 PM

After:
Screenshot 2025-11-07 at 3 39 51 PM

Why is it checking `router` if it passes `navigate` to the constructor?
@gggritso gggritso requested a review from a team as a code owner November 7, 2025 20:43
@linear
Copy link

linear bot commented Nov 7, 2025

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Nov 7, 2025
Copy link
Member

@nikkikapadia nikkikapadia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@gggritso gggritso merged commit 62e63f6 into master Nov 10, 2025
48 checks passed
@gggritso gggritso deleted the georgegritsouk/dain-1069-prevent-re-render-of-widget-builder-caused-by-widget branch November 10, 2025 16:37
Jesse-Box pushed a commit that referenced this pull request Nov 12, 2025
…il` when opening the Widget Builder (#102984)

`DashboardDetail` is the whole dashboard, so it's expensive to
re-render. Right now, when the Widget Builder opens it re-renders twice.
One of them is legitimate, because the Widget Builder is now open. One
of them is because `widgetBuilderSelectionState` was re-calculated,
which is not needed.

We only need to recalculate the selection state if the URL selection
changed. If it did not, skip it, and skip the render. This saves like a
300ms render in some cases.

**Before:**
<img width="310" height="190" alt="Screenshot 2025-11-07 at 3 37 09 PM"
src="https://github.com/user-attachments/assets/490819f5-21a5-4621-91c8-c349377486e1"
/>

**After:**
<img width="313" height="218" alt="Screenshot 2025-11-07 at 3 39 51 PM"
src="https://github.com/user-attachments/assets/2b6f455a-7586-494d-af76-20fee4b85170"
/>
andrewshie-sentry pushed a commit that referenced this pull request Nov 13, 2025
…il` when opening the Widget Builder (#102984)

`DashboardDetail` is the whole dashboard, so it's expensive to
re-render. Right now, when the Widget Builder opens it re-renders twice.
One of them is legitimate, because the Widget Builder is now open. One
of them is because `widgetBuilderSelectionState` was re-calculated,
which is not needed.

We only need to recalculate the selection state if the URL selection
changed. If it did not, skip it, and skip the render. This saves like a
300ms render in some cases.

**Before:**
<img width="310" height="190" alt="Screenshot 2025-11-07 at 3 37 09 PM"
src="https://github.com/user-attachments/assets/490819f5-21a5-4621-91c8-c349377486e1"
/>

**After:**
<img width="313" height="218" alt="Screenshot 2025-11-07 at 3 39 51 PM"
src="https://github.com/user-attachments/assets/2b6f455a-7586-494d-af76-20fee4b85170"
/>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants