Skip to content

feat(react-router): remove deprecated data in favor of loaderData#14931

Open
MichaelDeBoey wants to merge 1 commit intov8from
remove-deprecated-data
Open

feat(react-router): remove deprecated data in favor of loaderData#14931
MichaelDeBoey wants to merge 1 commit intov8from
remove-deprecated-data

Conversation

@MichaelDeBoey
Copy link
Copy Markdown
Member

Follow-up of #14047

CC/ @rossipedia

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 26, 2026

⚠️ No Changeset found

Latest commit: fca625c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR completes the migration started in #14047 by removing the deprecated data field from match/meta-related types and runtime objects, standardizing on loaderData across React Router’s match APIs.

Changes:

  • Removed deprecated data from match/meta TypeScript types (MetaMatch, MetaArgs, Match, UIMatch).
  • Updated runtime match conversion (convertRouteMatchToUiMatch) to no longer emit a data property.
  • Updated unit and integration tests to assert against loaderData only.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/react-router/lib/types/route-module-annotations.ts Removes data from match/meta annotation types and updates type-level tests to index loaderData.
packages/react-router/lib/router/utils.ts Removes deprecated UIMatch.data and stops emitting it in convertRouteMatchToUiMatch.
packages/react-router/lib/dom/ssr/routeModules.ts Removes deprecated data from SSR meta types (MetaMatch, MetaArgs).
packages/react-router/lib/dom/ssr/components.tsx Stops passing/setting data in SSR <Meta> wiring; uses loaderData only.
packages/react-router/tests/dom/data-static-router-test.tsx Updates expected useMatches() shapes to exclude data.
packages/react-router/tests/data-memory-router-test.tsx Updates useMatches() assertions to exclude data.
integration/matches-test.ts Updates integration expectations to exclude data.
integration/catch-boundary-test.ts Updates integration expectations to exclude data.
Comments suppressed due to low confidence (1)

packages/react-router/lib/dom/ssr/routeModules.ts:172

  • The MetaFunction JSDoc example in this file still references the removed data argument and match.data property (e.g. ({ data, matches }) and matches.find(...).data). Since this PR removes data in favor of loaderData, those docs should be updated to prevent users from copying broken examples.
export interface MetaArgs<
  Loader extends LoaderFunction | ClientLoaderFunction | unknown = unknown,
  MatchLoaders extends Record<
    string,
    LoaderFunction | ClientLoaderFunction | unknown
  > = Record<string, unknown>,
> {
  loaderData:
    | (Loader extends LoaderFunction | ClientLoaderFunction
        ? SerializeFrom<Loader>
        : unknown)
    | undefined;
  params: Params;
  location: Location;
  matches: MetaMatches<MatchLoaders>;
  error?: unknown;

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@MichaelDeBoey MichaelDeBoey force-pushed the remove-deprecated-data branch from 6261caf to fca625c Compare March 26, 2026 01:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants