Rendering performance optimizations (Issue #7 part 2.1) #8

Merged
Pakobbix merged 2 commits from issue-7-rendering-performance into main 2026-07-12 11:33:38 +00:00
2 Commits
Author SHA1 Message Date
ARIA f8894a9f3c Fix: Scope event handlers to container in userStats.js
Fixes critical bug identified by Zephyre_Review: event handlers used
global jQuery selectors instead of container-scoped selectors, causing
potential event handler leaks and scope mismatches.
2026-07-12 13:14:19 +02:00
ARIA 24c964c38d Fixes #7: Rendering performance optimizations
- requestAnimationFrame batching: rerenderRpgState() now batches all
  render calls into a single animation frame, reducing reflow/repaint costs

- Lightweight change detection: Render functions use updateIfChanged() to
  skip DOM updates when content hasn't changed, and only re-bind event
  handlers when the DOM was actually updated

- CSS content-visibility: Added content-visibility: auto with
  contain-intrinsic-size to inventory and equipment containers, deferring
  rendering of off-screen content

New file: src/systems/rendering/renderUtils.js (rendering utilities module)
Updated: All render modules + sillytavern.js integration + style.css
2026-07-12 13:10:17 +02:00