Performance: Query parameters and fragments
MEDIUM IMPACT
This affects page load speed and interaction responsiveness by how Angular processes URL changes and updates the view.
this.router.navigate([], { fragment: 'section2', queryParamsHandling: 'preserve' });
this.router.navigate([], { queryParams: { filter: 'new' }, queryParamsHandling: 'merge' });
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Full queryParams update with navigate() | Multiple DOM updates | 1 reflow per update | High paint cost | [X] Bad |
| Fragment update only with navigate() and fragment option | Minimal DOM changes | 0 reflows | Minimal paint cost | [OK] Good |