~ knotless Search/
↑↓ move↵ open⇧↵ all results

grain.social/grain

photography-focused photo sharing platform

grain.social
1 collaborator
0
2

next: a tab takes one click to its root, and back steps up where it should

Merged
Merged chadtmiller.com asked to merge into feature/hud from grain.social/grain:next/nav

What changes

A tab takes one click. Choosing Home, Explore, Notifications or Profile in the sidebar, rail or bar now shows that tab's root, as its link says, and lets go of the screens left over it. Before, the shell kept each tab's stack as it was left. So on your profile, clicking Home showed Home's stack, which still had a profile pushed over the feed, and only a second click reached the feed.

Your own profile is the Profile tab. A link to your own profile, or its URL (/profile/<your handle>, loaded or visited), opens the Profile tab at its root. Before, it was a copy pushed over Home with a back arrow. On the server, screenAt checks again once the answer names the signed-in account.

Back and opening, tuned.

  • A screen opened over the same screen isn't pushed again.
  • A screen opened on another tab, like a search from the sidebar while on Home, starts from that tab's root. Before, it went on top of whatever Explore had left.
  • The back arrow, where the entry before isn't the screen under it, replaces the history entry instead of adding one. So the browser's back still goes where it went.

Signed out, no forms. The stack gives forms no tools signed out, so Comment shows as its count instead of opening a form that can't send.

This is vendor/hud at HUD 21ca387 (app/shell).

Why

Reported on next.grain.social: clicking around, you had to click twice. In the recording, on your profile, Home highlighted on the first click but still showed the profile with a back arrow. That was Home's own stack, holding a profile pushed when /profile/<handle> was loaded, since that route opens under the first tab. The page changed only on the second click. Web navigation is expected to go where its link says, so tabs now go to their roots.

How it was checked

  • HUD: svelte-check (0 errors), npm run unit (16 pass), and the renderer and shell SSR tests. The shell SSR test adds three checks. Signed in, choosing Explore then Home from a pushed screen lands on Home's root in one click, at /. A link to your own profile chooses the Profile tab at its root (/profile/me.test). screenAt draws /profile/<own handle> as the Profile tab's root, and another account's profile over Home.
  • In a browser: a release HUD on :8931 with HUD_APPS a copy of this next/, and next/ on vite with the shell synced in. Driven signed out in Chromium at 1440 and 390 wide. I loaded /profile/manton.org, chose Explore and then Home (one click, at /), and opened a gallery, author, followers, follower, camera, all cameras, location and its map, and search results with their People tab. I used the back arrow, browser back and forward, reloads, and deep links (/profile/…/gallery/…, /camera/…), with no console errors. A search from Home now goes back to Explore's root, then to Home.
  • This branch: node check-apps.mjs, svelte-check and npm run build in next/.

Shortcomings

  • Leaving a tab drops the screens you'd opened on it. That's the trade for one click; the root keeps its scroll.
  • I can't sign in locally, so the signed-in paths (your profile, Create, Settings, Notifications) are covered by the shell SSR test with a fake server, not a browser.
Approved

This pull syncs vendor/hud to HUD 21ca387. A tab choice now goes to that tab's root and drops the screens over it. A link to your own profile chooses the Profile tab. A screen opened over itself isn't pushed again. The back arrow replaces the history entry. Signed out, forms get no tools. I read the whole diff and checked that the new calls match the surrounding code: same and tabPath are imported where the diff uses them, and ontab, rooted and choose fit together. I found nothing that needs changing.

Two small things, neither blocking:

  • screenAt in server.ts compares tabPath against url.pathname only. tabAt in the shell compares against pathname + search. This only differs for a tab whose path carries a query, so I'd expect no effect for the current tabs.
  • The signed-in paths are covered only by the SSR test with a fake server, as the body says.

Thanks. On the first point: in screenAt the URL can carry a query a link added (?utm_source=), so it compares paths, as its first tab check does for a tab with no query. In the browser, tabAt sees only URLs the app made itself, so the whole path is exact. No current tab has a query. Leaving both as they are.

Merged as f69bc1a
Part of a stack of 2
  1. next: a tab takes one click to its root, and back steps up where it should Landed as f69bc1a
  2. main