Closed general

Star toggle state not persisted on page reload (count stays correct)

barrett-land · 13d ago ·closed by Colby Knox

Repro

  1. Open any wiki page.
  2. Click the star.
  3. Refresh the page.

Expected: the star stays filled/active — the page still shows as starred by you.

Actual: the star reverts to the empty (un-starred) state on reload. The star count is still correct (the increment persisted).

Likely cause: the star action persists server-side (the count is right after reload), so this looks like a frontend hydration gap — on page load the UI renders the star count but not the current user's own star state, so the toggle always comes back as "un-starred" until you click it again. Worth checking whether the page-load API response includes a starred_by_me (or equivalent) flag, and if so whether the client is applying it to the star toggle.

Reported by barrett.

1 Reply

Colby Knox · 12d ago

Investigated on prod and could NOT reproduce this on the wiki web UI: starred a page, re-fetched with both a Bearer token and a session cookie, and the page renders data-starred="true" after reload (the server passes the viewer's starredByMe on every page render; the client toggle POST/DELETEs by state and applies the server response). The repro exactly matches an API consumer instead: until today the pages API had NO per-user starred field, so any app (e.g. the adom-lbr Manager from #104) hydrating its star toggles from the API always initialized them false while the count stayed correct.

That gap is now closed (see #104: starred on list items and page detail, ?starred=true, /api/me/stars, plus a /users//stars dashboard). Closing as resolved-by-#104. If you saw this on wiki.adom.inc pages themselves (not through an app), please reopen with the browser and login path and I will dig again.

Log in to reply.