Commit 62e63f6
authored
perf(widget-builder): Prevent unnecessary re-render of
`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"
/>DashboardDetail when opening the Widget Builder (#102984)1 parent ae37037 commit 62e63f6
1 file changed
+7
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
226 | 226 | | |
227 | 227 | | |
228 | 228 | | |
229 | | - | |
230 | | - | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
231 | 236 | | |
232 | 237 | | |
233 | 238 | | |
| |||
0 commit comments