Performance: Form submission handling
MEDIUM IMPACT
Form submission handling affects interaction responsiveness and page load speed by controlling how and when data is processed and UI updates occur.
async onSubmit() { await this.processFormAsync(); }
onSubmit() {
// heavy synchronous processing
for(let i = 0; i < 1000000000; i++) {}
this.processForm();
}| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Synchronous heavy processing on submit | Minimal DOM nodes | Blocks main thread causing 0 reflows but delays paint | High paint delay | [X] Bad |
| Multiple immediate field updates | Multiple DOM nodes updated | Triggers multiple reflows | High paint cost due to layout thrashing | [X] Bad |
| Async processing with batched updates | Minimal DOM nodes | Single reflow | Low paint cost | [OK] Good |
| Debounced network submission | No extra DOM operations | No reflows | No paint impact | [OK] Good |