Add a new future.v7_fetcherPersist flag to the @remix-run/router to change the persistence behavior of fetchers when router.deleteFetcher is called. Instead of being immediately cleaned up, fetchers will persist until they return to an idle state (RFC) (#10962)
This is sort of a long-standing bug fix as the useFetchers() API was always supposed to only reflect in-flight fetcher information for pending/optimistic UI -- it was not intended to reflect fetcher data or hang onto fetchers after they returned to an idle state
Keep an eye out for the following specific behavioral changes when opting into this flag and check your app for compatibility:
Fetchers that complete while still mounted will no longer appear in useFetchers(). They served effectively no purpose in there since you can access the data via useFetcher().data).
Fetchers that previously unmounted while in-flight will not be immediately aborted and will instead be cleaned up once they return to an idle state. They will remain exposed via useFetchers while in-flight so you can still access pending/optimistic data after unmount.
When v7_fetcherPersist is enabled, the router now performs ref-counting on fetcher keys via getFetcher/deleteFetcher so it knows when a given fetcher is totally unmounted from the UI (#10977)
Once a fetcher has been totally unmounted, we can ignore post-processing of a persisted fetcher result such as a redirect or an error
The router will also pass a new deletedFetchers array to the subscriber callbacks so that the UI layer can remove associated fetcher data
Add support for optional path segments in matchPath (#10768)
Patch Changes
Fix router.getFetcher/router.deleteFetcher type definitions which incorrectly specified key as an optional parameter (#10960)
1.10.0
Minor Changes
Add experimental support for the View Transitions API by allowing users to opt-into view transitions on navigations via the new unstable_viewTransition option to router.navigate (#10916)
Patch Changes
Allow 404 detection to leverage root route error boundary if path contains a URL segment (#10852)
Fix ErrorResponse type to avoid leaking internal field (#10876)
1.9.0
Minor Changes
In order to move towards stricter TypeScript support in the future, we're aiming to replace current usages of any with unknown on exposed typings for user-provided data. To do this in Remix v2 without introducing breaking changes in React Router v6, we have added generics to a number of shared types. These continue to default to any in React Router and are overridden with unknown in Remix. In React Router v7 we plan to move these to unknown as a breaking change. (#10843)
Location now accepts a generic for the location.state value
ActionFunctionArgs/ActionFunction/LoaderFunctionArgs/LoaderFunction now accept a generic for the context parameter (only used in SSR usages via createStaticHandler)
The return type of useMatches (now exported as UIMatch) accepts generics for match.data and match.handle - both of which were already set to unknown
Move the @private class export ErrorResponse to an UNSAFE_ErrorResponseImpl export since it is an implementation detail and there should be no construction of ErrorResponse instances in userland. This frees us up to export a type ErrorResponse which correlates to an instance of the class via InstanceType. Userland code should only ever be using ErrorResponse as a type and should be type-narrowing via isRouteErrorResponse. (#10811)
Removed private/internal APIs only required for the Remix v1 backwards compatibility layer and no longer needed in Remix v2 (_isFetchActionRedirect, _hasFetcherDoneAnything) (#10715)
Patch Changes
Add method/url to error message on aborted query/queryRoute calls (#10793)
Fix a race-condition with loader/action-thrown errors on route.lazy routes (#10778)
Fix type for actionResult on the arguments object passed to shouldRevalidate (#10779)
Most Recent Ignore Conditions Applied to This Pull Request
| Dependency Name | Ignore Conditions |
| --- | --- |
| @remix-run/router | [>= 1.8.a, < 1.9] |
You can trigger a rebase of this PR by commenting @dependabot rebase.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Note
Automatic rebases have been disabled on this pull request as it has been open for over 30 days.
Bumps @remix-run/router from 1.7.1 to 1.11.0.
Changelog
Sourced from
@remix-run/router
's changelog.... (truncated)
Commits
667f936
chore: Update version for release (#10981)67af262
chore: Update version for release (pre) (#10978)1500288
Updates for v7_fetcherPersist post-processing logic (#10977)cacc90b
chore: Update version for release (pre) (#10966)19af0cf
Add future.v7_fetcherPersist flag (#10962)c0dbcd2
Add useFetcher(key) and <Form navigate={false}> (#10960)677d6c8
Support optional path segments inmatchPath
(#10768)a71b4e2
Merge branch 'release-next' into devedd9ad4
chore: Update version for release (#10935)e2c0d82
Split up router-test.ts (#10929)Most Recent Ignore Conditions Applied to This Pull Request
| Dependency Name | Ignore Conditions | | --- | --- | | @remix-run/router | [>= 1.8.a, < 1.9] |You can trigger a rebase of this PR by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show