Commit 4039221
CIS Guru
fix: Prevent brand theme flicker when clicking same NavLink repeatedly
Two issues resolved:
1. NavMenu.razor: Guard OnLocationChanged to only run when URL actually changes
- Prevents unnecessary theme re-application on same-link clicks
- Eliminates redundant StateHasChanged calls
2. theme.js: Optimize MutationObserver to only watch theme attributes
- Changed from observing entire document.body with childList+subtree
- Now only observes documentElement with attributeFilter
- Prevents observer from firing on every Blazor NavLink re-render
- Eliminates unnecessary reflow operations that caused visual flicker
The combination of these fixes ensures clicking the same NavLink multiple times
no longer causes the brand theme to temporarily switch to Bootstrap.1 parent 8aad539 commit 4039221
2 files changed
Lines changed: 11 additions & 5 deletions
File tree
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
118 | | - | |
119 | | - | |
120 | | - | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
336 | 336 | | |
337 | 337 | | |
338 | 338 | | |
339 | | - | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
340 | 346 | | |
341 | 347 | | |
342 | 348 | | |
| |||
0 commit comments