Minor Changes
- Added the
Portalcomponent for rendering children into the document body or a custom container. In server-rendered apps, portals must be nested within a client entry to render their content. StandalonecreateRoot()apps that don't usePortalorFramedon't download its renderer. (#12344)
Patch Changes
-
Fix components nested inside
clientEntry()props being unable to read context from a provider in the same props or fromhandle.context.set()on the client entry itself during server rendering. Consumers nested inside host elements, fragments, frames, portals, or arrays within client entry props previously receivedundefinedfromhandle.context.get(), which could throw or serialize mismatched hydration props. (#12487) -
The browser runtime is smaller and does less work, with no changes to app code. In our measurements, a minimal
createRoot()app is about 40% smaller minified and gzipped, an app that also useson()andcss()is about 20% smaller, and an app that hydrates withrun()is about 10% smaller. Apps served as unbundled ESM byremix/assetsalso make fewer module requests. (#12398)- Standalone
createRoot()apps only load the code for the features they import. Stylesheet management and class-name generation load withcss(), the mixin engine loads withcreateMixin(), and CSP nonce tracking and the frame runtime load only withFrameorrun(). - Standalone calls to
navigate(),updateUrl(),defaultPrefetch(), andspaResponse, and components that use thelink()mixin, no longer load the frame renderer. - Updates to lists that mix keyed and unkeyed children skip repeated searches for child types with no match, and appending keyed children skips a pass over the old children.
- Frame updates that reorder client entries or nested frames no longer search the same sibling list for each entry, and frame responses that add import map entries no longer copy the mappings the page already installed.
- Hydration finds frames and client entries in one pass and only waits on DOM branches that contain frames.
- Focus, text selection, and scroll positions are only saved and restored when moving an element drops focus, instead of on every update.
- Standalone
-
Fix
css()dropping descriptor and definition at-rules such as@property,@font-face,@counter-style,@font-palette-values,@page, and@position-tryby emitting them before the generated class instead of nesting the class selector inside them. Conditional and scoping rules (@media,@supports,@container,@layer,@scope,@starting-style) still wrap the class. (#12458) -
Fix
css()emitting nested selector keys that do not start with&,@,:,., or[(such ash2or'ul:hover &') as invalid[object Object]declarations instead of nested rules. (#12474) -
Fix a boolean attribute given an empty string, such as
disabled: ""from an untyped attribute object, being removed at hydration. The server rendereddisabled="", but the browser set thedisabledproperty to"", which is false, so a control disabled in the server HTML became enabled without a warning. (#12385) -
Fix an element rendering at the end of its parent when it replaces a hydrated empty string, such as
{text && <p>{text}</p>}aftertextchanges from''. The server renders nothing for an empty string, so hydration had appended the empty text node after the parent's other children, and the new element took that position. (#12348) -
Preserve the form data and submit button of intercepted form submissions in Firefox, including when the submit button is removed before the navigation event, so frame navigations receive the submitter's overrides and the native form data. (#12391)
-
Fix a frame that is still waiting for its preloads staying on its server HTML when a sibling frame finishes hydrating first. (#12410)
-
Fix a retried frame response appending an import map again after the browser had already installed it. When a later import map in the same response failed to install, Remix discarded its record of the maps that succeeded. (#12411)
-
Preserve the submit button's name and value in a frame POST when the button is disabled after the browser collects the form data. (#12388)
-
Preserve input focus and selection when a frame reload reorders surviving client entries or nested frames. (#12461)
-
Show streamed child frame content as soon as its template arrives, even when the opening
<template>tag is split across two network chunks. Previously the content could wait until the parent response finished. (#12407) -
Client hydration and rendering are faster, with no changes to app code. In our 4x CPU-throttled Chromium benchmarks, hydration is 2.1x–2.8x faster (table hydration 27.6 ms → 13.3 ms total, dashboard hydration 24.2 ms → 8.6 ms total) and client list and dashboard updates do 15%–30% less scripting work. (#12465)
- Hydrating matched server-rendered elements skips redundant DOM attribute and inline
stylewrites (avoiding unnecessary style recalculation) while still patching mismatched attributes, styles, and property-only props. - All-primitive interpolated text children consolidate into a single text node so hydration adopts the server text node without calling
splitText(). jsx(), host reconciliation, and child diffing allocate fewer objects and avoid unnecessary DOMinstanceofchecks and ancestor<select>traversals.
- Hydrating matched server-rendered elements skips redundant DOM attribute and inline
-
Send the page being left as the
Refererof a client navigation's request. Previously the request carried its own destination as theReferer, because the Navigation API commits the destination URL before Remix fetches it. A server that redirects back after a form post, such as a cart endpoint that returns to the referring page, redirected to the form's action instead. (#12384)Nested frame loads keep the document's default referrer. Links with an explicit
referrerpolicy, and links or forms withrel="noreferrer", now use native document navigation so the browser enforces their referrer restrictions, and these links are no longer prefetched. -
Fix
clientEntry()components passed as props or children to anotherclientEntry()failing to hydrate. Previously, serializing the outer entry's props rendered the nested entry into static markup and dropped its client mixins; nested entries now hydrate as independent client boundaries, keep their state and event handlers across outer updates and frame reloads, and load dynamically when rendered later on the client (such as inside closed dialogs or portals). (#12233) -
Rendering and hydration fixes: (#12441)
- A mixin can read its own
handle.signalinbeforeUpdateandcommitlisteners when its component schedules an update. - A client entry whose loader throws synchronously can load again on a later render instead of staying failed.
- A keyed element that returns during its exit animation reuses its existing mixins without running setup again and picks up changes to its
innerHTML. - Range roots created with
createRangeRoot()keep hydration inside their boundaries when a server-rendered tag differs from the client tag or text spans several DOM nodes. Content outside the range is no longer changed or removed when the root is disposed.
- A mixin can read its own
-
Server rendering with
renderToString()andrenderToStream()is faster and uses less memory, with no changes to app code. In our measurements on Node 24,renderToString()throughput improves 2.4x–6.7x across representative page, table, dashboard, deep component tree, and escaping-heavy benchmarks, andrenderToStream()improves 1.1x–5.4x. (#12454)renderToString()renders directly to an HTML string without going through aReadableStreamor UTF-8 encode/decode round-trip.- Large component trees, inline
styleobjects,class/classNameattributes, and HTML escaping allocate less per render while producing identical HTML output.
-
Keep focus, iframe documents, running CSS animations, and open dialogs and popovers intact when keyed rendering or a frame reload reorders elements, in browsers that support
moveBefore(). Custom elements that defineconnectedMoveCallback()receive it for these moves instead ofdisconnectedCallback()andconnectedCallback(). Other browsers keep usinginsertBefore()and restore focus and selection after the move. (#12416) -
SVG
xlinkHrefandxlink:hrefprops now render as the SVG2hrefattribute on the server and in the browser, so<use xlinkHref="#icon-star" />renders<use href="#icon-star">instead of<use xlink:href="#icon-star">. All supported browsers resolvehrefon SVG elements. Other xlink props, such asxlinkTitle, still render with thexlink:prefix. Update any CSS selectors, tests, or scripts that look forxlink:hrefin rendered SVG. (#12441) -
Skip allocating an
AbortControllerand registering request abort listeners inrenderToStream()when a tree finishes synchronously without streaming frames or async client entries, return an empty stream immediately for pre-aborted signals, and resolve synchronousresolveClientEntryresults without extra promise wrapping. (#12463) -
Improve Back and Forward scroll restoration in Safari and Firefox when the destination takes time to load, while honoring manual restoration and visitor input during navigation. Positions saved after completed visits are restored once the destination renders. Entries left during an interrupted, failed, or superseded navigation fall back to browser restoration until a later navigation completes, so an older saved position does not override the browser. (#12295)
-
Preserve typed text and checkbox changes when an input renders again with
value={undefined}orchecked={undefined}. (#12405)