• Implement Phase 1 remaining tasks: notifications append-only, listener leak fix, memory caps

    laantungir released this 2026-07-01 13:33:29 +00:00 | 7 commits to master since this release

    Task 1.2: Append-only rendering for notifications page

    • Extracted buildNotificationRow(item) helper from renderNotifications()
    • Added prependNotificationRow(item) with sorted insertion by created_at
    • addNotificationFromEvent uses prepend when DOM has children

    Task 1.3: Fix notification document.click listener leak

    • Removed per-row document.addEventListener('click') that leaked on every render
    • Added single delegated click listener in main() using .notif-menu-panel class
    • Menu panels still close when clicking outside .notif-right

    Task 1.4: Cap posts[] and postIds with rolling eviction

    • Added MAX_STORED_POSTS=500 constant to feed.html and post.html
    • Added prunePostsArray() that sorts, slices, rebuilds postIds/renderedPostIds
    • Called in upsertFeedPost/upsertPost with +50 batch threshold
    • post.html skips pruning in event mode

    Task 1.5: Cap notificationsById/unreadNotificationsById with periodic pruning

    • Added MAX_STORED_NOTIFICATIONS=500, MAX_POST_IMAGE_CACHE=200
    • Added pruneNotificationMaps() that prunes both Maps and LRU-caps postImageCache
    • Called in addNotificationFromEvent, hydrateNotificationsFromCache/Relays

    Updated plan checklist marking all Phase 1 tasks complete.

    Downloads