Skip to content

Restore live updates for bulk Mark read - #27

Merged
jgordijn merged 1 commit into
mainfrom
t3/b287fafc-live-updates
Oct 13, 2026
Merged

jgordijn merged 1 commit into
mainfrom
t3/b287fafc-live-updates

Conversation

@jgordijn

@jgordijn jgordijn commented Oct 13, 2026 •

Copy link
Copy Markdown
Owner

Follow-up to #26 (merged).

Problem

#26 replaced the 200 per-entry PATCHes with one SQL UPDATE. That also dropped PocketBase's per-record realtime events, so other open tabs didn't see entries change to read until they reloaded.

Change

  • Server (internal/routes/mark_read.go): after the bulk UPDATE, send one update event per existing entry to clients subscribed to entries/* or entries/<id>. Like PocketBase, it applies the collection's List/View rule for each client. The event record is slim (id, is_read, updated, collection info) instead of the full entry with raw_content.
  • Client (ui/src/routes/+page.svelte): the feed already merges partial records. It now debounces the unread/bookmarked count reload by 300 ms on realtime updates, so a burst of 200 events triggers 2 count requests instead of 400.

Verification

Headless Chromium with two tabs against the real binary, 200 unread entries. Tab A clicks Mark read → All entries. Tab B is on All with cards expanded:

Tab B before after
Unread counter 400 200
Cards showing "✓ Read" 0 200
API requests made by tab B 2 (debounced counts)
  • go test ./internal/... -count=1 passes. The new test checks wildcard and per-record topics, denial for unauthenticated clients, no event for unknown ids, no event on unrelated topics, and no raw_content in the payload.
  • bunx vitest run: the 3 failures in daily-news/page.test.ts also fail on main.

🤖 Generated with Claude Code

Base automatically changed from t3/b287fafc to main October 13, 2026 15:06
The bulk mark-read endpoint skipped PocketBase's per-record realtime
events, so other open tabs did not see entries change until reload.

After the UPDATE, broadcast one "update" event per existing entry to
clients subscribed to entries (wildcard or per-record topics), applying
the collection's List/View rule per client like PocketBase does. The
event record carries only id, is_read and updated instead of the full
entry with raw_content; the feed already merges partial records.

The feed now debounces its unread/bookmarked count reload on realtime
updates, so a burst of 200 events triggers 2 requests instead of 400.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jgordijn
jgordijn force-pushed the t3/b287fafc-live-updates branch from 62fd2cb to 8d0091a Compare October 13, 2026 15:06
@jgordijn
jgordijn merged commit 5a1f7ca into main Oct 13, 2026
1 check passed
@jgordijn
jgordijn deleted the t3/b287fafc-live-updates branch October 13, 2026 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant