Performance: nextTick for DOM update timing
MEDIUM IMPACT
Controls when DOM updates happen after reactive data changes, affecting rendering timing and user interaction smoothness.
this.someData = newValue; this.$nextTick(() => { const height = this.$refs.element.clientHeight; });
this.someData = newValue; // Immediately access DOM that depends on someData const height = this.$refs.element.clientHeight;
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Immediate DOM read after data change | Multiple reads and writes | Multiple forced reflows | High paint cost due to layout thrashing | [X] Bad |
| Using nextTick to wait for DOM update | Batched DOM writes then reads | Single reflow after batch | Lower paint cost, smoother rendering | [OK] Good |