Current state: DOM element references are cached as jQuery objects in state.js.
Optimization opportunities:
jQuery object cache invalidation: When the panel is destroyed/rebuilt, cached jQuery references become stale. Add a cache invalidation mechanism.
Event listener cleanup: The unregisterAllEvents() function exists but should be verified to clean up all listeners, including those registered in sub-modules.
Debug log memory: debugLogs array in state.js is capped at 100 entries — good. But consider if it should be cleared on chat change.
I asked an AI to review Code Quality.
This is part 2.3 for the enhancement:
### 2.3 Memory Management
Current state: DOM element references are cached as jQuery objects in state.js.
**Optimization opportunities:**
- jQuery object cache invalidation: When the panel is destroyed/rebuilt, cached jQuery references become stale. Add a cache invalidation mechanism.
- Event listener cleanup: The unregisterAllEvents() function exists but should be verified to clean up all listeners, including those registered in sub-modules.
- Debug log memory: debugLogs array in state.js is capped at 100 entries — good. But consider if it should be cleared on chat change.
ARIA
self-assigned this 2026-07-12 12:05:08 +00:00
✅ jQuery cache invalidation: clearDomCache() clears all cached jQuery references on panel rebuild ✅ Event listener cleanup: All on()/once() handlers now tracked for cleanup by unregisterAllEvents() ✅ Debug log memory: clearDebugLogs() called on CHAT_CHANGED to prevent accumulation ✅ jQuery cleanup infrastructure: trackJQueryHandler()/cleanupJQueryEvents() ready for use
Tests: 25/25 passed (14 new memory management tests).
All memory management optimizations implemented:
✅ jQuery cache invalidation: clearDomCache() clears all cached jQuery references on panel rebuild
✅ Event listener cleanup: All on()/once() handlers now tracked for cleanup by unregisterAllEvents()
✅ Debug log memory: clearDebugLogs() called on CHAT_CHANGED to prevent accumulation
✅ jQuery cleanup infrastructure: trackJQueryHandler()/cleanupJQueryEvents() ready for use
Tests: 25/25 passed (14 new memory management tests).
PR: https://gitea.zephyre.one/Pakobbix/rpg-companion-sillytavern/pulls/12
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
I asked an AI to review Code Quality.
This is part 2.3 for the enhancement:
2.3 Memory Management
Current state: DOM element references are cached as jQuery objects in state.js.
Optimization opportunities:
I'll work on this. Give me a moment to inspect the codebase and prepare a fix.
All memory management optimizations implemented:
✅ jQuery cache invalidation: clearDomCache() clears all cached jQuery references on panel rebuild
✅ Event listener cleanup: All on()/once() handlers now tracked for cleanup by unregisterAllEvents()
✅ Debug log memory: clearDebugLogs() called on CHAT_CHANGED to prevent accumulation
✅ jQuery cleanup infrastructure: trackJQueryHandler()/cleanupJQueryEvents() ready for use
Tests: 25/25 passed (14 new memory management tests).
PR: #12