diff --git a/.changeset/tasty-falcons-press.md b/.changeset/tasty-falcons-press.md new file mode 100644 index 0000000000..288f527e17 --- /dev/null +++ b/.changeset/tasty-falcons-press.md @@ -0,0 +1,5 @@ +--- +'@backstage/core-components': minor +--- + +Made the `to` prop of `Button` and `Link` more strict, only supporting plain strings. It used to be the case that this prop was unexpectedly too liberal, making it look like we supported the complex `react-router-dom` object form of the parameter as well, which led to unexpected results at runtime. diff --git a/packages/core-components/api-report.md b/packages/core-components/api-report.md index 4e3820967a..1cdba47257 100644 --- a/packages/core-components/api-report.md +++ b/packages/core-components/api-report.md @@ -613,8 +613,9 @@ export const Link: (props: LinkProps) => JSX.Element; // Warning: (ae-missing-release-tag) "LinkProps" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal) // // @public (undocumented) -export type LinkProps = LinkProps_2 & - LinkProps_3 & { +export type LinkProps = Omit & + Omit & { + to: string; component?: ElementType; noTrack?: boolean; }; diff --git a/packages/core-components/src/components/Link/Link.tsx b/packages/core-components/src/components/Link/Link.tsx index 22b203d157..92ac92daad 100644 --- a/packages/core-components/src/components/Link/Link.tsx +++ b/packages/core-components/src/components/Link/Link.tsx @@ -47,8 +47,9 @@ const useStyles = makeStyles( export const isExternalUri = (uri: string) => /^([a-z+.-]+):/.test(uri); -export type LinkProps = MaterialLinkProps & - RouterLinkProps & { +export type LinkProps = Omit & + Omit & { + to: string; component?: ElementType; noTrack?: boolean; };