From eeb5d8cb5b0ba48d9f0ec6cf276f3093da4d1709 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Thu, 15 Aug 2024 13:33:57 +0200 Subject: [PATCH] docs/frontend-system: fix some extension examples Signed-off-by: Patrik Oldsberg --- .../architecture/20-extensions.md | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/docs/frontend-system/architecture/20-extensions.md b/docs/frontend-system/architecture/20-extensions.md index e142044d03..02f4ba9d05 100644 --- a/docs/frontend-system/architecture/20-extensions.md +++ b/docs/frontend-system/architecture/20-extensions.md @@ -139,11 +139,9 @@ const extension = createExtension({ // ... output: [coreExtensionData.reactElement.optional()], factory() { - return [ - coreExtensionData.reactElement.optional()( - Math.random() < 0.5 ? : undefined, - ), - ]; + return Math.random() > 0.5 + ? [coreExtensionData.reactElement(
Hello World
)] + : []; }, }); ``` @@ -327,18 +325,12 @@ The `ExtensionBoundary` can be used like the following in an extension: const routableExtension = createExtension({ // ... factory({ config, inputs, node }) { - const ExtensionComponent = lazy(() => - options - .loader({ config, inputs }) - .then(element => ({ default: () => element })), - ); - return [ coreExtensionData.path(config.path), - coreExtensionData.routeRef(options.routeRef), + coreExtensionData.routeRef(myRouteRef), coreExtensionData.reactElement( - + , ), ];