Skip to content

chore: Update version for release (pre) #13637

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 19, 2025

Conversation

github-actions[bot]
Copy link
Contributor

This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to release-next, this PR will be updated.

⚠️⚠️⚠️⚠️⚠️⚠️

release-next is currently in pre mode so this branch has prereleases rather than normal releases. If you want to exit prereleases, run changeset pre exit on release-next.

⚠️⚠️⚠️⚠️⚠️⚠️

Releases

[email protected]

Patch Changes

  • Update Route.MetaArgs to reflect that data can be potentially undefined (#13563)

    This is primarily for cases where a route loader threw an error to it's own ErrorBoundary. but it also arises in the case of a 404 which renders the root ErrorBoundary/meta but the root loader did not run because not routes matched.

  • Partially revert optimization added in 7.1.4 to reduce calls to matchRoutes because it surfaced other issues (#13562)

  • Fix typegen when same route is used at multiple paths (#13574)

    For example, routes/route.tsx is used at 4 different paths here:

    import { type RouteConfig, route } from "@react-router/dev/routes";
    export default [
      route("base/:base", "routes/base.tsx", [
        route("home/:home", "routes/route.tsx", { id: "home" }),
        route("changelog/:changelog", "routes/route.tsx", { id: "changelog" }),
        route("splat/*", "routes/route.tsx", { id: "splat" }),
      ]),
      route("other/:other", "routes/route.tsx", { id: "other" }),
    ] satisfies RouteConfig;

    Previously, typegen would arbitrarily pick one of these paths to be the "winner" and generate types for the route module based on that path.
    Now, typegen creates unions as necessary for alternate paths for the same route file.

  • Better types for params (#13543)

    For example:

    // routes.ts
    import { type RouteConfig, route } from "@react-router/dev/routes";
    
    export default [
      route("parent/:p", "routes/parent.tsx", [
        route("route/:r", "routes/route.tsx", [
          route("child1/:c1a/:c1b", "routes/child1.tsx"),
          route("child2/:c2a/:c2b", "routes/child2.tsx"),
        ]),
      ]),
    ] satisfies RouteConfig;

    Previously, params for routes/route were calculated as { p: string, r: string }.
    This incorrectly ignores params that could come from child routes.
    If visiting /parent/1/route/2/child1/3/4, the actual params passed to routes/route will have a type of { p: string, r: string, c1a: string, c1b: string }.

    Now, params are aware of child routes and autocompletion will include child params as optionals:

    params.|
    //     ^ cursor is here and you ask for autocompletion
    // p: string
    // r: string
    // c1a?: string
    // c1b?: string
    // c2a?: string
    // c2b?: string

    You can also narrow the types for params as it is implemented as a normalized union of params for each page that includes routes/route:

    if (typeof params.c1a === 'string') {
      params.|
      //     ^ cursor is here and you ask for autocompletion
      // p: string
      // r: string
      // c1a: string
      // c1b: string
    }

    UNSTABLE: renamed internal react-router/route-module export to react-router/internal
    UNSTABLE: removed Info export from generated +types/* files

  • Avoid initial fetcher execution 404 error when Lazy Route Discovery is interrupted by a navigation (#13564)

  • Remove hashes from files in dist/ for easier usage with patch-package (#13567)

  • href replaces splats * (#13593)

    const a = href("/products/*", { "*": "/1/edit" });
    // -> /products/1/edit

@react-router/[email protected]

Patch Changes

@react-router/[email protected]

Patch Changes

@react-router/[email protected]

Patch Changes

  • Prevent typegen with route files are outside the app directory (#12996)

  • Fix typegen when same route is used at multiple paths (#13574)

    For example, routes/route.tsx is used at 4 different paths here:

    import { type RouteConfig, route } from "@react-router/dev/routes";
    export default [
      route("base/:base", "routes/base.tsx", [
        route("home/:home", "routes/route.tsx", { id: "home" }),
        route("changelog/:changelog", "routes/route.tsx", { id: "changelog" }),
        route("splat/*", "routes/route.tsx", { id: "splat" }),
      ]),
      route("other/:other", "routes/route.tsx", { id: "other" }),
    ] satisfies RouteConfig;

    Previously, typegen would arbitrarily pick one of these paths to be the "winner" and generate types for the route module based on that path.
    Now, typegen creates unions as necessary for alternate paths for the same route file.

  • Add additional logging to build command output when cleaning assets from server build (#13547)

  • Better types for params (#13543)

    For example:

    // routes.ts
    import { type RouteConfig, route } from "@react-router/dev/routes";
    
    export default [
      route("parent/:p", "routes/parent.tsx", [
        route("route/:r", "routes/route.tsx", [
          route("child1/:c1a/:c1b", "routes/child1.tsx"),
          route("child2/:c2a/:c2b", "routes/child2.tsx"),
        ]),
      ]),
    ] satisfies RouteConfig;

    Previously, params for routes/route were calculated as { p: string, r: string }.
    This incorrectly ignores params that could come from child routes.
    If visiting /parent/1/route/2/child1/3/4, the actual params passed to routes/route will have a type of { p: string, r: string, c1a: string, c1b: string }.

    Now, params are aware of child routes and autocompletion will include child params as optionals:

    params.|
    //     ^ cursor is here and you ask for autocompletion
    // p: string
    // r: string
    // c1a?: string
    // c1b?: string
    // c2a?: string
    // c2b?: string

    You can also narrow the types for params as it is implemented as a normalized union of params for each page that includes routes/route:

    if (typeof params.c1a === 'string') {
      params.|
      //     ^ cursor is here and you ask for autocompletion
      // p: string
      // r: string
      // c1a: string
      // c1b: string
    }

    UNSTABLE: renamed internal react-router/route-module export to react-router/internal
    UNSTABLE: removed Info export from generated +types/* files

  • [UNSTABLE] Normalize dirent entry path across node versions when generating SRI manifest (#13591)

  • Don't clean assets from server build when build.ssrEmitAssets has been enabled in Vite config (#13547)

  • Fix href for optional segments (#13595)

    Type generation now expands paths with optionals into their corresponding non-optional paths.
    For example, the path /user/:id? gets expanded into /user and /user/:id to more closely model visitable URLs.
    href then uses these expanded (non-optional) paths to construct type-safe paths for your app:

    // original: /user/:id?
    // expanded: /user & /user/:id
    href("/user"); // ✅
    href("/user/:id", { id: 1 }); // ✅

    This becomes even more important for static optional paths where there wasn't a good way to indicate whether the optional should be included in the resulting path:

    // original: /products/:id/detail?
    
    // before
    href("/products/:id/detail?"); // ❌ How can we tell `href` to include or omit `detail?` segment with a complex API?
    
    // now
    // expanded: /products/:id & /products/:id/detail
    href("/product/:id"); // ✅
    href("/product/:id/detail"); // ✅
  • Updated dependencies:

[email protected]

Patch Changes

@react-router/[email protected]

Patch Changes

@react-router/[email protected]

Patch Changes

@react-router/[email protected]

Patch Changes

@react-router/[email protected]

Patch Changes

@react-router/[email protected]

Patch Changes

[email protected]

@brophdawg11 brophdawg11 merged commit ec173d8 into release-next May 19, 2025
1 check passed
@brophdawg11 brophdawg11 deleted the changeset-release/release-next branch May 19, 2025 18:33
@timdorr
Copy link
Member

timdorr commented May 19, 2025

Previously, params for routes/route were calculated as { p: string, r: string }.
This incorrectly ignores params that could come from child routes.
If visiting /parent/1/route/2/child1/3/4, the actual params passed to routes/route will have a type of { p: string, r: string, c1a: string, c1b: string }.

Just a small typo on this changeset. It should be route/route, not routes/route.

@brophdawg11
Copy link
Contributor

I think he's referring to the filename not the path there? It's confusing through and probably better to go with a parent/layout/child path to avoid confusion

@timdorr
Copy link
Member

timdorr commented May 19, 2025

Ah, I missed that. But yeah, some more distinctive naming would probably be a good thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants