feat(ui): resolve route-relative hrefs by default in useDefinition

Made href resolution always-on in useDefinition instead of requiring
each component to opt in via resolveHref: true. The hook now always
calls useInRouterContext/useHref and only applies the resolved value
when an href prop is actually provided, preventing href from leaking
into components that don't accept it.

Removed the resolveHref field from ComponentConfig, the
ResolveHrefConstraint type, and resolveHref: true from all 14
component definitions. Also removed a now-unnecessary type cast
in the Text component.

Signed-off-by: Johan Persson <johanopersson@gmail.com>
This commit is contained in:
Johan Persson
2026-04-08 15:58:20 +02:00
parent aba2f0a980
commit 2840476b04
15 changed files with 15 additions and 60 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/ui': patch
---
Resolved route-relative `href` props to absolute paths by default in all components, removing the need for the `resolveHref` option in component definitions.