Performance: Displaying validation errors
MEDIUM IMPACT
This affects page load speed and interaction responsiveness by how validation errors are rendered and updated in the DOM.
<?php if($errors->has('email')): ?> <span class="error"><?php echo e($errors->first('email')); ?></span> <?php endif; ?>
<?php if($errors->any()): ?> <ul> <?php foreach($errors->all() as $error): ?> <li><?php echo e($error); ?></li> <?php endforeach; ?> </ul> <?php endif; ?>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Full error list rerender | Many nodes added/removed | Multiple reflows per submission | High paint cost due to many elements | [X] Bad |
| Field-specific error display | Few nodes updated | Single reflow per error field | Low paint cost | [OK] Good |