Performance: Flash message categories
LOW IMPACT
This concept affects how quickly flash messages appear and update on the page, impacting user interaction responsiveness.
from flask import flash flash('Operation successful', 'success') flash('Warning: Check your input', 'warning') flash('Error occurred', 'error') # In template, group messages by category and render once per category
from flask import flash flash('Operation successful', 'success') flash('Warning: Check your input', 'warning') flash('Error occurred', 'error') # In template, rendering all messages without filtering or batching
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Render all flash messages individually | Multiple insertions | Multiple reflows (one per message) | High paint cost | [X] Bad |
| Group flash messages by category before rendering | Few insertions | Single reflow per category | Lower paint cost | [OK] Good |