From 41af2944bc6be9cb25f8b92f73641879d918e49f Mon Sep 17 00:00:00 2001 From: MangaValk Date: Thu, 22 Oct 2026 00:13:46 +0200 Subject: [PATCH] Faster web UI: only changed lists reloaded, icon cache kept, storage usage cached - Web UI: loadLists(only) fetches only the lists an action changed; saving a bitmap, icon or font also reloads the pages that use it - Icons: a save or delete forgets only that name and updates the name list in place instead of listing the directory again - Storage usage cached until a store writes or deletes a file (at most 60 s): /api/status 0.6 s -> 0.08 s - Version 2.19.2 Co-Authored-By: Claude Opus 5.5 --- CLAUDE.md | 9 +++++ src/esp32/config.h | 2 +- src/esp32/display/bitmap_store.cpp | 25 +++++++++++- src/esp32/display/bitmap_store.h | 2 + src/esp32/display/font_store.cpp | 2 + src/esp32/display/icon_store.cpp | 51 ++++++++++++++++++++---- src/esp32/display/page_store.cpp | 2 + src/esp32/web/web_page.h | 62 ++++++++++++++++++------------ 8 files changed, 120 insertions(+), 35 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 8d9a169..31e26e0 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -227,6 +227,15 @@ See README.md for the overview. takes about 100 ms, and pages are drawn for every frame and every web preview. Writes must go through `saveBitmap()`/`deleteBitmap()`, which clear the cache. Long JSON lists are sent in pieces of about 2 KB (`sendPiece()` in `web_ui.cpp`). +- Icons are cached too (`display/icon_store`, all of them). A save or delete only forgets + that name (`forget()`) and updates the cached name list in place (`listAdd()`/ + `listRemove()`): clearing it all made the next icon list read every icon again (7 s). +- Storage usage (`bitmapStorageUsage()`, for `/api/status`) is cached: `usedBytes()` walks + the file system (about 0.5 s). Every store calls `bitmapStorageChanged()` after a write + or delete; the cache also expires after 60 s. +- The web UI reloads only the lists that changed (`loadLists(only)`, the ESP32 answers one + request at a time): saving a bitmap, icon or font also reloads the pages when a page + uses it (`pagesUsing()`, `pagesWithFont()`). - Check the page's JavaScript after changes: extract the `