frontend-patterns/research/candidates/URLAddressableState.md

81 lines
4.6 KiB
Markdown
Raw Normal View History

---
title: URL-addressable State
status: draft
maturity: hypothesis
families: [address, projection]
scales: [L3]
admission: research-candidate-only
---
# URL-addressable State
Context: readers need to share, bookmark and revisit a resource or selected view.
Problem: an address change can conceal state that only exists in the current tab.
Addressability competes with private/transient state and URL/schema stability.
Proposed solution: encode the public, stable resource identity and relevant view
selection in path/query parameters, or in a fragment when a declared client runtime
reconstructs the view. Define validation, defaults and the required resolution path
so direct entry and reload reconstruct that selection under current authorization.
A client-fragment contract does not imply no-script availability. A URL identifies a view, not necessarily immutable bytes or guaranteed
future availability. Use an explicit version if a stable historical snapshot matters.
Do not place secrets, private draft content, focus or every transient interaction
in the address. An identifier confers no authorization. Server-visible query/path
state and fragment-only state have different resolution contracts. If history is
enhanced, back/forward, cache misses and direct loads must resolve coherently;
pushState success alone is insufficient.
Consequences: views become independently reachable, but parameter compatibility,
invalid/deleted resources and full-versus-fragment cache behavior need contracts.
Alternatives: ephemeral in-tab selection when sharing is unnecessary; authenticated
saved-view identifiers when the selection is too large or private for the URL.
Evidence: [navigation review](../reviews/NavigationRenderingEvidence.md) N01/N02/N06
locates documentation mechanisms, not verified deployments of this whole proposal.
Full-pattern known uses and recurrence remain unknown. Refines the existing URL as
Application State seed; no canonical identity or admitted relations.
Proposed connection: [Progressive Enhancement](ProgressiveEnhancement.md) can preserve
native navigation while adding faster transitions; it is optional, not required by
addressability. [VC-03](../walkthroughs/VC03-ContentPublication.md) is a synthetic trace.
## Prospective runtime corroboration — 2026-09-27
Direct filtered entry, reload, snapshot restoration and explicit history-miss recovery
preserve selection in a pinned htmx fixture. Omitting representation Vary reproduces
a fragment served as a full document in Chromium and Firefox; correct selection
keeps representations distinct, without promising cache retention or freshness.
See [NH01–NH06](../reviews/NavigationHistoryExperiment.md). One authored application
with a real package, not independent deployed recurrence. Hypothesis retained.
## Competing completion ownership — 2026-09-27
[NO01–NO06](../reviews/NavigationOwnershipExperiment.md) show a delayed history response
replacing content/title while a newer URL remains selected in the unguarded fixture.
Treat navigation initiation, including Back/Forward, as intent with an explicit
completion owner. Before applying an asynchronous result, check that it still owns
the selected route; include URL, content, title and feedback in that decision.
A response to obsolete intent is not made current by arriving last or succeeding.
The experiment's latest-intent policy keeps the last committed view and newest error
when a newer request fails; it does not revive older pending navigation implicitly.
Other policies require an explicit contract. Browser history can change the URL before
loading completes: pending-state disclosure/recovery is still unresolved here.
The authored guard supports this obligation only in the tested schedules, not a
portable router or proof of independent application recurrence.
## Independent application source contrast — 2026-09-27
[Zulip ZN01–ZN08](../reviews/ZulipNavigationSourceStudy.md) locates pinned hash-to-view
reconstruction, separate history pointer/offset state, and current-list guards on
main fetch continuations. It supplies static partial application evidence; no direct
load or Back race was executed in Zulip. Auxiliary lookup/anchor paths and deferred
focus remain unverified.
Applicability belongs to each effect: noncurrent results can still populate cached
data without acquiring the right to change current selection. Object/list identity
and a navigation generation are different implementation policies; neither alone
proves freshness. Keep addressability separate from no-script enhancement and from
within-session focus/scroll restoration. Full-contract recurrence remains unassessed.