Repository navigation
fix(ui): register views synchronously so extensions get their routes - #5725
Merged
SteKoe merged 1 commit intoOct 1, 2026
Merged
Conversation
Since codecentric#5542, `ViewRegistry._addView` is `async`, so `addView` returns promises. `useViewRegistry().addView` (exposed as `SBA.viewRegistry`) still reads `addView(...)[0]` as a view, so once the router exists `view.path` is undefined and `ensureAbsolutePath` throws "Cannot read properties of undefined (reading 'startsWith')". UI extensions are loaded as <script> tags after the router is created, so every extension view is affected: it lands in the registry but gets no route (e.g. "My Extensions" of spring-boot-admin-sample-custom-ui). `_addView` never awaits anything; only `isEnabled` needs to support promises, and it still does.
SteKoe
approved these changes
Oct 1, 2026
SteKoe
enabled auto-merge (squash)
October 1, 2026 14:06
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #5724
Since #5542,
ViewRegistry._addViewisasync, butuseViewRegistry().addView(exposed asSBA.viewRegistry) still readsaddView(...)[0]as a view. Once the router exists,view.pathis undefined and the route registration throwsCannot read properties of undefined (reading 'startsWith'). UI extensions always load after the router is created, so every extension view is affected, includingspring-boot-admin-sample-custom-ui._addViewnever awaits anything, so this makes it synchronous again.isEnabledstill acceptsboolean | Promise<boolean>, so the async enablement from #5542 (MCP view) is unchanged.Tests:
composables/ViewRegistry.spec.tsregisters a top-level view and a child view throughuseViewRegistry()aftercreateRouter(). Both tests failed with the reported TypeError before the change and pass after it.npm run test(554 tests),npm run lint(only the 3 existing warnings),npm run formatandnpm run buildare green.Verified manually with
spring-boot-admin-sample-servlet+spring-boot-admin-sample-custom-uion 4.1.3 with this patch: "My Extensions" and the instance "Custom" view are back and the console is clean.Screenshots and recordings: see #5724.