Skip to content

Commit

Permalink
fix build failure
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-Cena committed Mar 18, 2022
1 parent ef38c6c commit 89978ea
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/docusaurus-types/src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ export interface RouteContext {
/**
* Plugin-specific context data.
*/
data: object | undefined;
data?: object | undefined;
}

/**
Expand Down
11 changes: 10 additions & 1 deletion packages/docusaurus/src/client/exports/ComponentCreator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,16 @@ export default function ComponentCreator(
if (path === '*') {
return Loadable({
loading: Loading,
loader: () => import('@theme/NotFound'),
loader: async () => {
const NotFound = (await import('@theme/NotFound')).default;
return (props) => (
// Is there a better API for this?
<RouteContextProvider
value={{plugin: {name: 'native', id: 'default'}}}>
<NotFound {...(props as never)} />
</RouteContextProvider>
);
},
});
}

Expand Down
1 change: 1 addition & 0 deletions packages/docusaurus/src/client/routeContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ function mergeContexts({
return value;
}

// TODO deep merge this
const data = {...parent.data, ...value?.data};

return {
Expand Down

0 comments on commit 89978ea

Please sign in to comment.