Skip to content

remix/component · Function

View Source

updateUrl

Summary

Reflects locally rendered state in the URL without fetching, rendering, or changing scroll/focus. Preserves history state and synchronizes Remix metadata and the top-frame source. Waits for the active transition and requires the captured browser URL to remain current. Supersession, navigation/URL changes, and cancellation resolve with an aborted signal. Newer calls supersede waiting calls. Cancellation reasons are available on the returned signal. Native interception of this update is unsupported (NotSupportedError); it may still commit. Cross-origin URLs reject with SecurityError; other failures propagate. Do not await this inside the captured transition's interception handler.

Signature

function updateUrl(href: string, options: UpdateUrlOptions): Promise<AbortSignal>

Parameters

href

Same-origin URL, resolved against document.baseURI when applied. An empty string retains the current URL.

options

History mode (default: "replace") and cancellation signal.

Returns

The update's signal: aborted on cancellation, otherwise permanently non-aborted.