feat(ui): centralize routing in BUIProvider (#33267)
* feat(ui): centralize routing in BUIProvider BUIProvider now auto-detects React Router context and provides client-side navigation for all BUI components. Retired InternalLinkProvider and added BUIRouterProvider as a public export for integration use. Signed-off-by: Johan Persson <johanopersson@gmail.com> * feat(plugin-app): move BUIProvider inside app router Moved BUIProvider from wrapping AppRouter to being a child inside it, so it detects the React Router context and provides client-side routing for all BUI components. Signed-off-by: Johan Persson <johanopersson@gmail.com> * feat(core-app-api): add BUIRouterProvider to legacy app router Added BUIRouterProvider inside the legacy AppRouter to provide React Aria routing for all BUI components. Signed-off-by: Johan Persson <johanopersson@gmail.com> * docs(ui): update BUIProvider documentation for routing Updated installation docs to cover BUIProvider's routing role and the requirement to render it inside a React Router context. Signed-off-by: Johan Persson <johanopersson@gmail.com> * refactor(ui): move BUIProvider from analytics to provider directory BUIProvider now handles both analytics and routing, so it no longer belongs in the analytics directory. Signed-off-by: Johan Persson <johanopersson@gmail.com> * fix(ui): add BUIProvider to storybook stories with MemoryRouter Added BUIProvider inside MemoryRouter in all stories that use routing, so client-side navigation works in Storybook. Signed-off-by: Johan Persson <johanopersson@gmail.com> * fix(plugin-app): move BUIProvider inside RouterComponent Moved BUIProvider to wrap all content inside RouterComponent so that extraElements (like dialogs) also get BUI context. Signed-off-by: Johan Persson <johanopersson@gmail.com> * refactor: replace BUIRouterProvider with BUIProvider in legacy app Use BUIProvider directly inside the legacy AppRouter instead of a separate BUIRouterProvider export. Removes BUIRouterProvider from the public API of @backstage/ui. Signed-off-by: Johan Persson <johanopersson@gmail.com> * refactor(ui): inline routing logic into BUIProvider Removed the routing/ directory and inlined the RouterProvider setup directly into BUIProvider since it's the only consumer. Signed-off-by: Johan Persson <johanopersson@gmail.com> --------- Signed-off-by: Johan Persson <johanopersson@gmail.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/core-app-api': patch
|
||||
---
|
||||
|
||||
Added `BUIProvider` inside the legacy app router to enable client-side routing for all BUI components.
|
||||
@@ -0,0 +1,23 @@
|
||||
---
|
||||
'@backstage/ui': minor
|
||||
---
|
||||
|
||||
**BREAKING**: Centralized client-side routing in `BUIProvider`. Components like Link, ButtonLink, Tabs, Menu, TagGroup, and Table now require a `BUIProvider` rendered inside a React Router context for client-side navigation to work.
|
||||
|
||||
**Migration:**
|
||||
|
||||
This change requires updating `@backstage/plugin-app` and `@backstage/core-app-api` alongside `@backstage/ui`. If you only upgrade `@backstage/ui`, BUI components will fall back to full-page navigation.
|
||||
|
||||
If you cannot upgrade all packages together, or if you have a custom app shell, add a `BUIProvider` inside your Router:
|
||||
|
||||
```diff
|
||||
+ import { BUIProvider } from '@backstage/ui';
|
||||
|
||||
<BrowserRouter>
|
||||
+ <BUIProvider>
|
||||
<AppContent />
|
||||
+ </BUIProvider>
|
||||
</BrowserRouter>
|
||||
```
|
||||
|
||||
**Affected components:** Link, ButtonLink, Tabs, Menu, TagGroup, Table
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-app': patch
|
||||
---
|
||||
|
||||
Moved `BUIProvider` inside the app router to enable automatic client-side routing for all BUI components.
|
||||
Reference in New Issue
Block a user