Skip to content

fix: re-fetch route list after closing direct-link route view#594

Open
sshane wants to merge 2 commits into
masterfrom
fix-segment-routes-meta
Open

fix: re-fetch route list after closing direct-link route view#594
sshane wants to merge 2 commits into
masterfrom
fix-segment-routes-meta

Conversation

@sshane
Copy link
Copy Markdown
Contributor

@sshane sshane commented Apr 30, 2026

Summary

When you visit `/dongleId/log_id` directly (no back history) and then click X to close, the dashboard shows only that one route until you refresh.

`checkRoutesData` takes a fast path when `state.segmentRange` is set, fetching only the targeted route. But it then dispatched `ACTION_ROUTES_METADATA` with `start`/`end` equal to the full filter range, so `hasRoutesData` returned true on the next check. `DriveList`'s visibility hook saw cached metadata and didn't refetch.

Pass `null` start/end when the fetch was segment-scoped. `hasRoutesData` then returns false, and the next `checkRoutesData` (fired by `DriveList` becoming visible after close) fills in the full filter range.

Test plan

  • Open `/dongleId/log_id` directly in a fresh tab → only that route loads (existing fast-path behavior preserved)
  • Click X → dashboard shows the full route list, no refresh needed
  • Open `/dongleId` directly → list loads normally, opening any route still works
  • `pnpm lint` clean
  • `pnpm test` passes (30/30)

🤖 Generated with Claude Code

Visiting /dongleId/log_id directly takes a fast path that fetches just
that one route via the segmentRange filter. The fetch then dispatched
ACTION_ROUTES_METADATA with the full filter range as the covered
range, so hasRoutesData reported true even though only one route had
been loaded. Clicking X to close back to the dashboard left the user
looking at a one-route list, since DriveList's checkRoutesData
visibility hook saw cached metadata and didn't re-fetch.

Mark the metadata range as null when the fetch was segment-scoped, so
the next checkRoutesData (fired by DriveList becoming visible) fills
in the full filter range.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 30, 2026

Welcome to connect! Make sure to:

  • read the contributing guidelines
  • mark your PR as a draft until it's ready to review
  • post the preview on Discord; feedback from users will speedup the PR review

deployed preview: https://594.connect-d5y.pages.dev

VisibilityHandler in DriveList only triggers onVisible from
visibilitychange/focus/blur events, not on mount. When the user
clicks X to close a route view, the dashboard remounts but no fetch
runs — the metadata fix from the previous commit is necessary but
not sufficient on its own.

Pass onInit so the handler fires once on mount; minInterval=60 still
gates subsequent visibility events. checkRoutesData's own
hasRoutesData check prevents redundant fetches when the cache is
already valid.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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