Skip to content

fix(mobile): resolve a stickied wiki page by book+id, not id alone - #11

Merged
sixvolts merged 2 commits into
mainfrom
ci/wiki-sticky-book
Sep 6, 2026
Merged

sixvolts merged 2 commits into
mainfrom
ci/wiki-sticky-book

Conversation

@sixvolts

@sixvolts sixvolts commented Sep 5, 2026

Copy link
Copy Markdown
Owner

Tapping a Home-pinned wiki page intermittently showed "Page not found" and dropped into a blank editable page — reported for a grocery-list page in a shared book. The page was never missing server-side.

Cause: the pin routed to #wiki/ (id only), and openPage discovered the book by scanning the CURRENTLY ACTIVE book's page list (refresh only loads the active book, and picks "most recent" when none is set). So whenever the app reopened onto a different book than the page lives in, the id was never in the loaded list, the fallback refresh pulled the wrong book, and the user landed on "Page not found" + blank body. Hence intermittent: fine when the page's book happened to be active, broken otherwise.

The backend already sends what was needed — HomePin carries book_slug and the pins query populates it for every book. Pure client fix:

  • openPage now accepts "bookSlug/pageId" as well as bare "pageId"; given a book, it selects that book and loads its pages BEFORE resolving the id. Bare-id (old stickies, other deep links) still works via the scan.
  • The Home wiki pin, the page-list row, the after-create nav, and the wiki-link nav all qualify the route with the book slug they already know. parseRoute needs no change: detail already keeps everything after the tab.

Regression test in mobile.spec.ts (runs under the Pixel 7 mobile project): pin a page in book A, select book B in the UI, tap the pin, assert it opens A's page and the route is book-qualified rather than the "Page not found" blank.

Tapping a Home-pinned wiki page intermittently showed "Page not found" and
dropped into a blank editable page — reported for a grocery-list page in a
shared book. The page was never missing server-side.

Cause: the pin routed to #wiki/<pageId> (id only), and openPage discovered the
book by scanning the CURRENTLY ACTIVE book's page list (refresh only loads the
active book, and picks "most recent" when none is set). So whenever the app
reopened onto a different book than the page lives in, the id was never in the
loaded list, the fallback refresh pulled the wrong book, and the user landed on
"Page not found" + blank body. Hence intermittent: fine when the page's book
happened to be active, broken otherwise.

The backend already sends what was needed — HomePin carries book_slug and the
pins query populates it for every book. Pure client fix:

- openPage now accepts "bookSlug/pageId" as well as bare "pageId"; given a
  book, it selects that book and loads its pages BEFORE resolving the id.
  Bare-id (old stickies, other deep links) still works via the scan.
- The Home wiki pin, the page-list row, the after-create nav, and the
  wiki-link nav all qualify the route with the book slug they already know.
  parseRoute needs no change: detail already keeps everything after the tab.

Regression test in mobile.spec.ts (runs under the Pixel 7 mobile project): pin
a page in book A, select book B in the UI, tap the pin, assert it opens A's
page and the route is book-qualified rather than the "Page not found" blank.
The first cut asserted book B gained is-active after a click, but books list
orders by updated_at DESC and B (its page created last) was already the default
active book — so the click was a no-op, the class never changed, and the test
failed in setup. Worse, it meant the scenario under test was never exercised:
the bug needs the pinned page book (A) to NOT be active.

Now: open the wiki tab, click B only if A is the active card, then poll until A
is definitively not active. That is the real precondition and it is robust to
whichever book defaults active. The fix under test is unchanged.
@sixvolts
sixvolts merged commit f19790f into main Sep 6, 2026
1 check passed
@sixvolts
sixvolts deleted the ci/wiki-sticky-book branch September 6, 2026 01:40
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