feat(atoms)!: 675 — one asyncRouteAtom API for async route data - #98
Open
randomdevpete wants to merge 3 commits into
Conversation
`resolvedAtom` and `asyncRouteAtom` were two entry points over one mechanism: `asyncRouteAtom` already built on `resolvedAtom`, and their loader types were the same shape under two names. They differed only in whether the load gates the parent route's match. That axis is now which member you read, not which function you call. `asyncRouteAtom(route, name, load)` exposes `.data` - a plain async atom of the loaded value, with no bearing on matching and no lifecycle to wire up, exactly what `resolvedAtom` was. Reading the returned atom as a route instead gates the match on the load, as before. Promoting data loading to route gating is dropping `.data`. BREAKING CHANGE: `resolvedAtom` is removed. `resolvedAtom(route, load)` becomes `asyncRouteAtom(route, name, load).data`, where `name` is what the loaded object binds to if the route is ever used for gating. `followResolvedRedirects` is renamed `followAsyncRedirects` and takes `.data` atoms. `preloadRoutes` is renamed `preloadAsyncRoutes`, matching `hydrateAsyncRoutes`/`followAsyncRoutes`. The `Resolver` and `RouteLookup` types are replaced by one `RouteLoader`, and `AsyncRouteAtom.lookup` is renamed `data`. `hydrateAsyncRoutes`, `followAsyncRoutes` and `AsyncRouteSnapshot` are unchanged. Ticket: 675
…d API Ticket: 675
Ticket: 675
This was referenced Aug 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Coalesces
resolvedAtomandasyncRouteAtominto one constructor,asyncRouteAtom(route, name, load).asyncRouteAtomwas already built onresolvedAtom, and their loader types were the same shape under two names; they differed only in whether the load gates the parent route's match.That axis is now which member you read, not which function you call:
.data—Atom<Promise<Data | Redirect | undefined>>, a plain async atom with no bearing on matching and no lifecycle to wire up. This is exactly whatresolvedAtomwas.nameinvalues, using thepreloadAsyncRoutes/hydrateAsyncRoutes/followAsyncRouteslifecycle as before.A single mode argument was rejected because the two uses return different kinds (data atom vs route atom); two thin wrappers were rejected because that is what the code already was.
Migration
resolvedAtom(route, load)asyncRouteAtom(route, name, load).datafollowResolvedRedirects(store, atoms)followAsyncRedirects(store, dataAtoms)preloadRoutes(store, routes)preloadAsyncRoutes(store, routes)AsyncRouteAtom.lookupAsyncRouteAtom.dataResolver<T, Data>,RouteLookup<T, Data>RouteLoader<T, Data>resolvedAtom.tsasyncRouteAtom.tshydrateAsyncRoutes,followAsyncRoutesandAsyncRouteSnapshotare unchanged. No deprecated aliases — the packages are on the2.0.0-betaline and CODING-STYLE.md bans pre-production compat hedging.Stacking
Stacked on #90 (
task-679-investigate-per-demo-scoped-store-context), which touches the samejarl-atomsfiles. Retargets tomasterautomatically once #90 merges.Style review (this PR)
Reviewed the producing branch against CODING-STYLE.md line by line — no changes were needed:
Ticket: 675.resolvedAtom.tscarried a large "v1 porting history" comment block; it's gone, not carried forward.oxfmt --checkpasses on every touched file (verified from the standingmasterworktree).resolvedAtom/RouteLookup/followResolvedRedirects/preloadRoutes/.lookupanywhere exceptCHANGELOG.md(historical, correct) ande2e/registry-smoke(see below).Deliberate exceptions
README.mdis untouched even though it namesasyncRouteAtomin prose. Verified this is not a missed reformat:README.mdis explicitly listed in.prettierignore(which oxfmt honours), andci.ymlhas noformat:checkstep at all — nothing in CI or tooling scope covers this file.e2e/registry-smokestill usesresolvedAtom/followResolvedRedirects. It installsjarl-atoms@latestfrom npm to exercise the published tarballs, so it must keep matching npm until this change ships. Confirmed inci.yml: that job's condition isgithub.event_name == 'workflow_dispatch' && inputs.registry_smoke— it never runs on apull_requesttrigger, so it is genuinely outside this PR's CI path. It needs updating as part of the release that ships this change.For OWNER
feat!, which.releaserc.json's major-version suppression currently turns into a minor, like every other breaking change so far. This is a removal fromjarl-atoms' published surface, so it's a reasonable candidate for lifting that suppression — flagged, not decided.e2e/registry-smokeneeds updating as part of whatever release actually ships this change (see exception 2 above) — it will keep testing the old, still-publishedresolvedAtomAPI until then, which is correct until release day but not after.🤖 Generated with Claude Code