frontend-app-api: make createApp options optional
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/frontend-app-api': patch
|
||||
---
|
||||
|
||||
The options parameter of `createApp` is now optional.
|
||||
@@ -27,7 +27,7 @@ export type AppRouteBinder = <
|
||||
) => void;
|
||||
|
||||
// @public (undocumented)
|
||||
export function createApp(options: {
|
||||
export function createApp(options?: {
|
||||
features?: (BackstagePlugin | ExtensionOverrides)[];
|
||||
configLoader?: () => Promise<ConfigApi>;
|
||||
bindRoutes?(context: { bind: AppRouteBinder }): void;
|
||||
|
||||
@@ -222,7 +222,7 @@ function deduplicateFeatures(
|
||||
}
|
||||
|
||||
/** @public */
|
||||
export function createApp(options: {
|
||||
export function createApp(options?: {
|
||||
features?: (BackstagePlugin | ExtensionOverrides)[];
|
||||
configLoader?: () => Promise<ConfigApi>;
|
||||
bindRoutes?(context: { bind: AppRouteBinder }): void;
|
||||
@@ -240,11 +240,11 @@ export function createApp(options: {
|
||||
);
|
||||
|
||||
const discoveredFeatures = getAvailableFeatures(config);
|
||||
const loadedFeatures = (await options.featureLoader?.({ config })) ?? [];
|
||||
const loadedFeatures = (await options?.featureLoader?.({ config })) ?? [];
|
||||
const allFeatures = deduplicateFeatures([
|
||||
...discoveredFeatures,
|
||||
...loadedFeatures,
|
||||
...(options.features ?? []),
|
||||
...(options?.features ?? []),
|
||||
]);
|
||||
|
||||
const tree = createAppTree({
|
||||
@@ -268,7 +268,7 @@ export function createApp(options: {
|
||||
<RoutingProvider
|
||||
{...extractRouteInfoFromAppNode(tree.root)}
|
||||
routeBindings={resolveRouteBindings(
|
||||
options.bindRoutes,
|
||||
options?.bindRoutes,
|
||||
config,
|
||||
routeIds,
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user