⚡ Bolt: Optimize DOM updates and element reuse in PlayerList - #2
⚡ Bolt: Optimize DOM updates and element reuse in PlayerList#2SoftMissT wants to merge 1 commit into
Conversation
Batch className updates to reduce style recalculations and reuse existing Text and em nodes to eliminate repeated garbage collection from element creation. Prevent creation of orphaned span elements when target player DOM node is absent. Co-authored-by: SoftMissT <237180642+SoftMissT@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
💡 What:
classNameupdates into a single string assignment instead of multipleclassList.add()/remove()calls per latency tick.Textand<em>DOM child nodes inPlayerList.updateLatencyTextinstead of executingdocument.createElement('em')and wipingtextContenton every update cycle.makeLatencySpanto returnnullimmediately if the target player element (.player-name) is not in the DOM, preventing orphaned<span>nodes.🎯 Why:
document.createElement) and triggered multiple DOM layout/style recalculation steps per user element.📊 Impact:
🔬 Measurement:
npm testandnpm run build(including type check and package validation for Foundry VTT v14). All checks passed.PR created automatically by Jules for task 14546696445244481961 started by @SoftMissT