Releases: remix-run/react-router
v6.8.2
What's Changed
- Treat same-origin absolute URLs in
<Link to>
as external if they are outside of the routerbasename
(#10135) - Correctly perform a hard redirect for same-origin absolute URLs outside of the router
basename
(#10076) - Fix SSR of absolute
<Link to>
urls (#10112) - Properly escape HTML characters in
StaticRouterProvider
serialized hydration data (#10068) - Fix
useBlocker
to returnIDLE_BLOCKER
during SSR (#10046) - Ensure status code and headers are maintained for
defer
loader responses increateStaticHandler
'squery()
method (#10077) - Change
invariant
to anUNSAFE_invariant
export since it's only intended for internal use (#10066)
Full Changelog: https://github.com/remix-run/react-router/compare/[email protected]@6.8.2
v6.8.1
What's Changed
- Remove inaccurate console warning for POP navigations and update active blocker logic (#10030)
- Only check for differing origin on absolute URL redirects (#10033)
- Improved absolute url detection in
Link
component (now also supportsmailto:
urls) (#9994) - Fix partial object (search or hash only) pathnames losing current path value (#10029)
Full Changelog: https://github.com/remix-run/react-router/compare/[email protected]@6.8.1
v6.8.0
What's Changed
Minor Changes
Support absolute URLs in <Link to>
. If the URL is for the current origin, it will still do a client-side navigation. If the URL is for a different origin then it will do a fresh document request for the new origin. (#9900)
<Link to="https://neworigin.com/some/path"> {/* Document request */}
<Link to="//neworigin.com/some/path"> {/* Document request */}
<Link to="https://www.currentorigin.com/path"> {/* Client-side navigation */}
Patch Changes
- Fixes 2 separate issues for revalidating fetcher
shouldRevalidate
calls (#9948)- The
shouldRevalidate
function was only being called for explicit revalidation scenarios (after a mutation, manualuseRevalidator
call, or anX-Remix-Revalidate
header used for cookie setting in Remix). It was not properly being called on implicit revalidation scenarios that also apply to navigationloader
revalidation, such as a change in search params or clicking a link for the page we're already on. It's now correctly called in those additional scenarios. - The parameters being passed were incorrect and inconsistent with one another since the
current*
/next*
parameters reflected the staticfetcher.load
URL (and thus were identical). Instead, they should have reflected the the navigation that triggered the revalidation (as theform*
parameters did). These parameters now correctly reflect the triggering navigation.
- The
- Fix bug with search params removal via
useSearchParams
(#9969) - Respect
preventScrollReset
on<fetcher.Form>
(#9963) - Fix navigation for hash routers on manual URL changes (#9980)
- Use
pagehide
instead ofbeforeunload
for<ScrollRestoration>
. This has better cross-browser support, specifically on Mobile Safari. (#9945) - Do not short circuit on hash change only mutation submissions (#9944)
- Remove
instanceof
check fromisRouteErrorResponse
to avoid bundling issues on the server (#9930) - Detect when a
defer
call only contains critical data and remove theAbortController
(#9965) - Send the name as the value when url-encoding
File
FormData
entries (#9867) react-router-dom-v5-compat
- Fix SSRuseLayoutEffect
console.error
when usingCompatRouter
(#9820)
New Contributors
- @fyzhu made their first contribution in #9874
- @cassidoo made their first contribution in #9889
- @machour made their first contribution in #9893
- @jdufresne made their first contribution in #9916
- @LordThi made their first contribution in #9953
- @bbrowning918 made their first contribution in #9954
Full Changelog: v6.7.0...v6.8.0
v6.7.0
What's Changed
Minor Changes
- Add
unstable_useBlocker
/unstable_usePrompt
hooks for blocking navigations within the app's location origin (#9709, #9932) - Add
preventScrollReset
prop to<Form>
(#9886)
Patch Changes
- Added pass-through event listener options argument to
useBeforeUnload
(#9709) - Fix
generatePath
when optional params are present (#9764) - Update
<Await>
to acceptReactNode
as children function return result (#9896) - Improved absolute redirect url detection in actions/loaders (#9829)
- Fix URL creation with memory histories (#9814)
- Fix scroll reset if a submission redirects (#9886)
- Fix 404 bug with same-origin absolute redirects (#9913)
- Streamline
jsdom
bug workaround in tests (#9824)
New Contributors
- @damianstasik made their first contribution in #9835
- @akamfoad made their first contribution in #9877
- @lkwr made their first contribution in #9829
Full Changelog: v6.6.2...v6.7.0
v6.6.2
What's Changed
- Ensure
useId
consistency during SSR (#9805)
Full Changelog: https://github.com/remix-run/react-router/compare/[email protected]@6.6.2
v6.6.1
What's Changed
- Include submission info in
shouldRevalidate
on action redirects (#9777, #9782) - Reset
actionData
on action redirect to current location (#9772)
Full Changelog: https://github.com/remix-run/react-router/compare/[email protected]@6.6.1
v6.6.0
What's Changed
This minor release is primarily to stabilize our SSR APIs for Data Routers now that we've wired up the new RouterProvider
in Remix as part of the React Router-ing Remix work.
Minor Changes
- Remove
unstable_
prefix fromcreateStaticHandler
/createStaticRouter
/StaticRouterProvider
(#9738) - Add
useBeforeUnload()
hook (#9664)
Patch Changes
- Support uppercase
<Form method>
anduseSubmit
method values (#9664) - Fix
<button formmethod>
form submission overriddes (#9664) - Fix explicit
replace
on submissions andPUSH
on submission to new paths (#9734) - Prevent
useLoaderData
usage inerrorElement
(#9735) - Proper hydration of
Error
objects fromStaticRouterProvider
(#9664) - Skip initial scroll restoration for SSR apps with
hydrationData
(#9664) - Fix a few bugs where loader/action data wasn't properly cleared on errors (#9735)
Full Changelog: https://github.com/remix-run/react-router/compare/[email protected]@6.6.0
v6.5.0
What's Changed
This release introduces support for Optional Route Segments. Now, adding a ?
to the end of any path segment will make that entire segment optional. This works for both static segments and dynamic parameters.
Optional Params Examples
<Route path=":lang?/about>
will match:/:lang/about
/about
<Route path="/multistep/:widget1?/widget2?/widget3?">
will match:/multistep
/multistep/:widget1
/multistep/:widget1/:widget2
/multistep/:widget1/:widget2/:widget3
Optional Static Segment Example
<Route path="/home?">
will match:/
/home
<Route path="/fr?/about">
will match:/about
/fr/about
Minor Changes
- Allows optional routes and optional static segments (#9650)
Patch Changes
- Stop incorrectly matching on partial named parameters, i.e.
<Route path="prefix-:param">
, to align with how splat parameters work. If you were previously relying on this behavior then it's recommended to extract the static portion of the path at theuseParams
call site: (#9506)
// Old behavior at URL /prefix-123
<Route path="prefix-:id" element={<Comp /> }>
function Comp() {
let params = useParams(); // { id: '123' }
let id = params.id; // "123"
...
}
// New behavior at URL /prefix-123
<Route path=":id" element={<Comp /> }>
function Comp() {
let params = useParams(); // { id: 'prefix-123' }
let id = params.id.replace(/^prefix-/, ''); // "123"
...
}
- Persist
headers
onloader
request
's after SSR documentaction
request (#9721) - Fix requests sent to revalidating loaders so they reflect a GET request (#9660)
- Fix issue with deeply nested optional segments (#9727)
- GET forms now expose a submission on the loading navigation (#9695)
- Fix error boundary tracking for multiple errors bubbling to the same boundary (#9702)
Full Changelog: https://github.com/remix-run/react-router/compare/[email protected]@6.5.0
v6.4.5
What's Changed
- Fix requests sent to revalidating loaders so they reflect a
GET
request (#9680) - Remove
instanceof Response
checks in favor ofisResponse
(#9690) - Fix
URL
creation in Cloudflare Pages or other non-browser-environments (#9682, #9689) - Add
requestContext
support to static handlerquery
/queryRoute
(#9696)- Note that the unstable API of
queryRoute(path, routeId)
has been changed toqueryRoute(path, { routeId, requestContext })
- Note that the unstable API of
Full Changelog: https://github.com/remix-run/react-router/compare/[email protected]@6.4.5
v6.4.4
What's Changed
- Throw an error if an
action
/loader
function returnsundefined
as revalidations need to know whether the loader has previously been executed.undefined
also causes issues during SSR stringification for hydration. You should always ensure yourloader
/action
returns a value, and you may returnnull
if you don't wish to return anything. (#9511) - Properly handle redirects to external domains (#9590, #9654)
- Preserve the HTTP method on 307/308 redirects (#9597)
- Support
basename
in static data routers (#9591) - Enhanced
ErrorResponse
bodies to contain more descriptive text in internal 403/404/405 scenarios - Fix issues with encoded characters in
NavLink
and descendant<Routes>
(#9589, #9647) - Properly serialize/deserialize
ErrorResponse
instances when using built-in hydration (#9593) - Support
basename
in static data routers (#9591) - Updated dependencies:
@remix-run/[email protected]
[email protected]
Full Changelog: https://github.com/remix-run/react-router/compare/[email protected]@6.4.4