@darajs/core 1.20.3 → 1.21.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/navigate-to.d.ts.map +1 -1
- package/dist/actions/navigate-to.js +5 -1
- package/dist/actions/navigate-to.js.map +1 -1
- package/dist/api/core.d.ts +8 -20
- package/dist/api/core.d.ts.map +1 -1
- package/dist/api/core.js +5 -70
- package/dist/api/core.js.map +1 -1
- package/dist/api/index.d.ts +1 -1
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +1 -1
- package/dist/api/index.js.map +1 -1
- package/dist/auth/auth.d.ts +0 -20
- package/dist/auth/auth.d.ts.map +1 -1
- package/dist/auth/auth.js +0 -11
- package/dist/auth/auth.js.map +1 -1
- package/dist/auth/basic/basic-auth-login.js +4 -4
- package/dist/auth/basic/basic-auth-login.js.map +1 -1
- package/dist/auth/default/default-auth-login.js +4 -4
- package/dist/auth/default/default-auth-login.js.map +1 -1
- package/dist/auth/index.d.ts +0 -1
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +0 -1
- package/dist/auth/index.js.map +1 -1
- package/dist/components/fallback/default.d.ts +1 -0
- package/dist/components/fallback/default.d.ts.map +1 -1
- package/dist/components/fallback/default.js +3 -0
- package/dist/components/fallback/default.js.map +1 -1
- package/dist/components/index.d.ts +8 -5
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +8 -5
- package/dist/components/index.js.map +1 -1
- package/dist/components/link.d.ts +18 -0
- package/dist/components/link.d.ts.map +1 -0
- package/dist/components/link.js +89 -0
- package/dist/components/link.js.map +1 -0
- package/dist/components/menu-link.d.ts +4 -0
- package/dist/components/menu-link.d.ts.map +1 -0
- package/dist/components/menu-link.js +45 -0
- package/dist/components/menu-link.js.map +1 -0
- package/dist/components/{menu/menu.d.ts → menu.d.ts} +1 -1
- package/dist/components/menu.d.ts.map +1 -0
- package/dist/components/{menu/menu.js → menu.js} +6 -6
- package/dist/components/menu.js.map +1 -0
- package/dist/components/outlet.d.ts +3 -0
- package/dist/components/outlet.d.ts.map +1 -0
- package/dist/components/outlet.js +3 -0
- package/dist/components/outlet.js.map +1 -0
- package/dist/components/powered-by-causalens.d.ts +3 -0
- package/dist/components/powered-by-causalens.d.ts.map +1 -0
- package/dist/components/powered-by-causalens.js +25 -0
- package/dist/components/powered-by-causalens.js.map +1 -0
- package/dist/components/progress-tracker.d.ts.map +1 -0
- package/dist/components/{progress-tracker/progress-tracker.js → progress-tracker.js} +4 -4
- package/dist/components/progress-tracker.js.map +1 -0
- package/dist/components/{side-bar-frame/side-bar-frame.d.ts → side-bar-frame.d.ts} +2 -1
- package/dist/components/side-bar-frame.d.ts.map +1 -0
- package/dist/components/{side-bar-frame/side-bar-frame.js → side-bar-frame.js} +10 -13
- package/dist/components/side-bar-frame.js.map +1 -0
- package/dist/components/{top-bar-frame/top-bar-frame.d.ts → top-bar-frame.d.ts} +1 -1
- package/dist/components/top-bar-frame.d.ts.map +1 -0
- package/dist/components/{top-bar-frame/top-bar-frame.js → top-bar-frame.js} +6 -7
- package/dist/components/top-bar-frame.js.map +1 -0
- package/dist/dara_core-1.21.1-py3-none-any.whl +0 -0
- package/dist/index.css +42 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/pages/error-page.d.ts +12 -2
- package/dist/pages/error-page.d.ts.map +1 -1
- package/dist/pages/error-page.js +18 -10
- package/dist/pages/error-page.js.map +1 -1
- package/dist/pages/error-status-code-page.d.ts +13 -0
- package/dist/pages/error-status-code-page.d.ts.map +1 -0
- package/dist/pages/error-status-code-page.js +40 -0
- package/dist/pages/error-status-code-page.js.map +1 -0
- package/dist/pages/root-error-page.d.ts +3 -0
- package/dist/pages/root-error-page.d.ts.map +1 -0
- package/dist/pages/root-error-page.js +31 -0
- package/dist/pages/root-error-page.js.map +1 -0
- package/dist/pages/route-error-boundary.d.ts +3 -0
- package/dist/pages/route-error-boundary.d.ts.map +1 -0
- package/dist/pages/route-error-boundary.js +85 -0
- package/dist/pages/route-error-boundary.js.map +1 -0
- package/dist/router/cache.d.ts +19 -0
- package/dist/router/cache.d.ts.map +1 -0
- package/dist/router/cache.js +56 -0
- package/dist/router/cache.js.map +1 -0
- package/dist/router/context.d.ts +17 -0
- package/dist/router/context.d.ts.map +1 -0
- package/dist/router/context.js +21 -0
- package/dist/router/context.js.map +1 -0
- package/dist/router/create-router.d.ts +22 -0
- package/dist/router/create-router.d.ts.map +1 -0
- package/dist/router/create-router.js +210 -0
- package/dist/router/create-router.js.map +1 -0
- package/dist/router/fetching.d.ts +115 -0
- package/dist/router/fetching.d.ts.map +1 -0
- package/dist/router/fetching.js +280 -0
- package/dist/router/fetching.js.map +1 -0
- package/dist/router/index.d.ts +7 -0
- package/dist/router/index.d.ts.map +1 -0
- package/dist/router/index.js +7 -0
- package/dist/router/index.js.map +1 -0
- package/dist/router/route-content.d.ts +16 -0
- package/dist/router/route-content.d.ts.map +1 -0
- package/dist/router/route-content.js +112 -0
- package/dist/router/route-content.js.map +1 -0
- package/dist/router/router-root.d.ts +7 -0
- package/dist/router/router-root.d.ts.map +1 -0
- package/dist/router/router-root.js +15 -0
- package/dist/router/router-root.js.map +1 -0
- package/dist/run.d.ts +14 -1
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +41 -24
- package/dist/run.js.map +1 -1
- package/dist/shared/context/config-context.d.ts +7 -0
- package/dist/shared/context/config-context.d.ts.map +1 -0
- package/dist/shared/context/config-context.js +15 -0
- package/dist/shared/context/config-context.js.map +1 -0
- package/dist/shared/context/global-task-context.d.ts +2 -1
- package/dist/shared/context/global-task-context.d.ts.map +1 -1
- package/dist/shared/context/index.d.ts +2 -1
- package/dist/shared/context/index.d.ts.map +1 -1
- package/dist/shared/context/index.js +2 -1
- package/dist/shared/context/index.js.map +1 -1
- package/dist/shared/context/registries-context.d.ts +10 -7
- package/dist/shared/context/registries-context.d.ts.map +1 -1
- package/dist/shared/context/registries-context.js +49 -9
- package/dist/shared/context/registries-context.js.map +1 -1
- package/dist/shared/dynamic-component/dynamic-auth-component.d.ts +12 -0
- package/dist/shared/dynamic-component/dynamic-auth-component.d.ts.map +1 -0
- package/dist/shared/dynamic-component/dynamic-auth-component.js +53 -0
- package/dist/shared/dynamic-component/dynamic-auth-component.js.map +1 -0
- package/dist/shared/dynamic-component/dynamic-component.d.ts +10 -1
- package/dist/shared/dynamic-component/dynamic-component.d.ts.map +1 -1
- package/dist/shared/dynamic-component/dynamic-component.js +67 -7
- package/dist/shared/dynamic-component/dynamic-component.js.map +1 -1
- package/dist/shared/error-handling/error-display.js +2 -2
- package/dist/shared/index.d.ts +1 -2
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/index.js +1 -2
- package/dist/shared/index.js.map +1 -1
- package/dist/shared/interactivity/derived-variable.d.ts +62 -17
- package/dist/shared/interactivity/derived-variable.d.ts.map +1 -1
- package/dist/shared/interactivity/derived-variable.js +162 -96
- package/dist/shared/interactivity/derived-variable.js.map +1 -1
- package/dist/shared/interactivity/persistence.d.ts +5 -1
- package/dist/shared/interactivity/persistence.d.ts.map +1 -1
- package/dist/shared/interactivity/persistence.js +83 -5
- package/dist/shared/interactivity/persistence.js.map +1 -1
- package/dist/shared/interactivity/plain-variable.d.ts +2 -1
- package/dist/shared/interactivity/plain-variable.d.ts.map +1 -1
- package/dist/shared/interactivity/plain-variable.js +14 -2
- package/dist/shared/interactivity/plain-variable.js.map +1 -1
- package/dist/shared/interactivity/resolve-variable.d.ts +7 -1
- package/dist/shared/interactivity/resolve-variable.d.ts.map +1 -1
- package/dist/shared/interactivity/resolve-variable.js +56 -2
- package/dist/shared/interactivity/resolve-variable.js.map +1 -1
- package/dist/shared/interactivity/server-variable.d.ts +2 -1
- package/dist/shared/interactivity/server-variable.d.ts.map +1 -1
- package/dist/shared/interactivity/server-variable.js +18 -0
- package/dist/shared/interactivity/server-variable.js.map +1 -1
- package/dist/shared/interactivity/store.d.ts +0 -1
- package/dist/shared/interactivity/store.d.ts.map +1 -1
- package/dist/shared/interactivity/store.js.map +1 -1
- package/dist/shared/interactivity/tabular-variable.d.ts.map +1 -1
- package/dist/shared/interactivity/tabular-variable.js +5 -2
- package/dist/shared/interactivity/tabular-variable.js.map +1 -1
- package/dist/shared/interactivity/triggers.d.ts +7 -2
- package/dist/shared/interactivity/triggers.d.ts.map +1 -1
- package/dist/shared/interactivity/triggers.js +15 -2
- package/dist/shared/interactivity/triggers.js.map +1 -1
- package/dist/shared/interactivity/use-action.d.ts +6 -1
- package/dist/shared/interactivity/use-action.d.ts.map +1 -1
- package/dist/shared/interactivity/use-action.js +106 -44
- package/dist/shared/interactivity/use-action.js.map +1 -1
- package/dist/shared/interactivity/use-server-component.d.ts +4 -1
- package/dist/shared/interactivity/use-server-component.d.ts.map +1 -1
- package/dist/shared/interactivity/use-server-component.js +107 -38
- package/dist/shared/interactivity/use-server-component.js.map +1 -1
- package/dist/shared/interactivity/use-variable.js +1 -1
- package/dist/shared/interactivity/use-variable.js.map +1 -1
- package/dist/shared/{template-root/template-root.d.ts → root/authenticated-root.d.ts} +4 -5
- package/dist/shared/root/authenticated-root.d.ts.map +1 -0
- package/dist/shared/root/authenticated-root.js +86 -0
- package/dist/shared/root/authenticated-root.js.map +1 -0
- package/dist/shared/root/dynamic-context.d.ts.map +1 -0
- package/dist/shared/root/dynamic-context.js.map +1 -0
- package/dist/shared/root/unauthenticated-root.d.ts +7 -0
- package/dist/shared/root/unauthenticated-root.d.ts.map +1 -0
- package/dist/shared/root/unauthenticated-root.js +38 -0
- package/dist/shared/root/unauthenticated-root.js.map +1 -0
- package/dist/shared/utils/deferred.d.ts +10 -0
- package/dist/shared/utils/deferred.d.ts.map +1 -0
- package/dist/shared/utils/deferred.js +13 -0
- package/dist/shared/utils/deferred.js.map +1 -0
- package/dist/shared/utils/index.d.ts +1 -1
- package/dist/shared/utils/index.d.ts.map +1 -1
- package/dist/shared/utils/index.js +1 -1
- package/dist/shared/utils/index.js.map +1 -1
- package/dist/shared/utils/use-component-styles.d.ts +1 -1
- package/dist/shared/utils/use-component-styles.d.ts.map +1 -1
- package/dist/shared/utils/use-component-styles.js +2 -2
- package/dist/shared/utils/use-component-styles.js.map +1 -1
- package/dist/shared/utils/use-url-sync.d.ts +1 -13
- package/dist/shared/utils/use-url-sync.d.ts.map +1 -1
- package/dist/shared/utils/use-url-sync.js +18 -22
- package/dist/shared/utils/use-url-sync.js.map +1 -1
- package/dist/shared/utils/use-window-title.d.ts +1 -1
- package/dist/shared/utils/use-window-title.d.ts.map +1 -1
- package/dist/shared/utils/use-window-title.js +5 -5
- package/dist/shared/utils/use-window-title.js.map +1 -1
- package/dist/types/core.d.ts +90 -15
- package/dist/types/core.d.ts.map +1 -1
- package/dist/types/core.js +16 -1
- package/dist/types/core.js.map +1 -1
- package/dist/types/utils.d.ts +2 -2
- package/dist/types/utils.d.ts.map +1 -1
- package/dist/types/utils.js.map +1 -1
- package/dist/umd/{dara.core.umd.js → dara.core.umd.cjs} +62588 -46966
- package/dist/umd/style.css +52 -9
- package/package.json +15 -16
- package/dist/auth/auth-wrapper.d.ts +0 -15
- package/dist/auth/auth-wrapper.d.ts.map +0 -1
- package/dist/auth/auth-wrapper.js +0 -76
- package/dist/auth/auth-wrapper.js.map +0 -1
- package/dist/components/menu/menu.d.ts.map +0 -1
- package/dist/components/menu/menu.js.map +0 -1
- package/dist/components/progress-tracker/progress-tracker.d.ts.map +0 -1
- package/dist/components/progress-tracker/progress-tracker.js.map +0 -1
- package/dist/components/router-content/router-content.d.ts +0 -14
- package/dist/components/router-content/router-content.d.ts.map +0 -1
- package/dist/components/router-content/router-content.js +0 -18
- package/dist/components/router-content/router-content.js.map +0 -1
- package/dist/components/side-bar-frame/side-bar-frame.d.ts.map +0 -1
- package/dist/components/side-bar-frame/side-bar-frame.js.map +0 -1
- package/dist/components/top-bar-frame/top-bar-frame.d.ts.map +0 -1
- package/dist/components/top-bar-frame/top-bar-frame.js.map +0 -1
- package/dist/dara_core-1.20.3-py3-none-any.whl +0 -0
- package/dist/shared/private-route/private-route.d.ts +0 -19
- package/dist/shared/private-route/private-route.d.ts.map +0 -1
- package/dist/shared/private-route/private-route.js +0 -37
- package/dist/shared/private-route/private-route.js.map +0 -1
- package/dist/shared/template-root/dynamic-context.d.ts.map +0 -1
- package/dist/shared/template-root/dynamic-context.js.map +0 -1
- package/dist/shared/template-root/template-root.d.ts.map +0 -1
- package/dist/shared/template-root/template-root.js +0 -100
- package/dist/shared/template-root/template-root.js.map +0 -1
- package/dist/shared/utils/use-action-registry.d.ts +0 -11
- package/dist/shared/utils/use-action-registry.d.ts.map +0 -1
- package/dist/shared/utils/use-action-registry.js +0 -19
- package/dist/shared/utils/use-action-registry.js.map +0 -1
- package/dist/shared/utils/use-component-registry.d.ts +0 -11
- package/dist/shared/utils/use-component-registry.d.ts.map +0 -1
- package/dist/shared/utils/use-component-registry.js +0 -58
- package/dist/shared/utils/use-component-registry.js.map +0 -1
- /package/dist/components/{progress-tracker/progress-tracker.d.ts → progress-tracker.d.ts} +0 -0
- /package/dist/shared/{template-root → root}/dynamic-context.d.ts +0 -0
- /package/dist/shared/{template-root → root}/dynamic-context.js +0 -0
package/dist/run.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
import { QueryClient } from '@tanstack/react-query';
|
|
2
|
+
import type { WebSocketClientInterface } from './api';
|
|
1
3
|
import './index.css';
|
|
4
|
+
import { type Deferred } from './shared';
|
|
5
|
+
import type { DaraData } from './types';
|
|
2
6
|
declare global {
|
|
3
7
|
interface Window {
|
|
4
8
|
dara: DaraGlobals;
|
|
@@ -6,7 +10,16 @@ declare global {
|
|
|
6
10
|
}
|
|
7
11
|
interface DaraGlobals {
|
|
8
12
|
base_url: string;
|
|
13
|
+
ws: Deferred<WebSocketClientInterface>;
|
|
9
14
|
}
|
|
15
|
+
export declare function Root(props: {
|
|
16
|
+
daraData: DaraData;
|
|
17
|
+
queryClient: QueryClient;
|
|
18
|
+
importers: {
|
|
19
|
+
[k: string]: () => Promise<any>;
|
|
20
|
+
};
|
|
21
|
+
theme: any;
|
|
22
|
+
}): JSX.Element;
|
|
10
23
|
/**
|
|
11
24
|
* The main run function for the JS half of the application creates a div and binds the react app onto the tree. It sets
|
|
12
25
|
* up a lot of context providers for the rest of the application. It accepts an object of importers as an argument. An
|
|
@@ -17,6 +30,6 @@ interface DaraGlobals {
|
|
|
17
30
|
*/
|
|
18
31
|
declare function run(importers: {
|
|
19
32
|
[k: string]: () => Promise<any>;
|
|
20
|
-
}): void
|
|
33
|
+
}): Promise<void>;
|
|
21
34
|
export default run;
|
|
22
35
|
//# sourceMappingURL=run.d.ts.map
|
package/dist/run.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../js/run.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../js/run.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAuB,MAAM,uBAAuB,CAAC;AAUzE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,aAAa,CAAC;AAErB,OAAO,EAAE,KAAK,QAAQ,EAAsD,MAAM,UAAU,CAAC;AAI7F,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,MAAM;QACZ,IAAI,EAAE,WAAW,CAAC;KACrB;CACJ;AAED,UAAU,WAAW;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,EAAE,EAAE,QAAQ,CAAC,wBAAwB,CAAC,CAAC;CAC1C;AAED,wBAAgB,IAAI,CAAC,KAAK,EAAE;IACxB,QAAQ,EAAE,QAAQ,CAAC;IACnB,WAAW,EAAE,WAAW,CAAC;IACzB,SAAS,EAAE;QAAE,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,CAAA;KAAE,CAAC;IAC/C,KAAK,EAAE,GAAG,CAAC;CACd,GAAG,GAAG,CAAC,OAAO,CAoBd;AAED;;;;;;;GAOG;AACH,iBAAe,GAAG,CAAC,SAAS,EAAE;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAwBhF;AAED,eAAe,GAAG,CAAC"}
|
package/dist/run.js
CHANGED
|
@@ -1,18 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
11
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
3
|
-
import
|
|
12
|
+
import NProgress from 'nprogress';
|
|
4
13
|
import { createRoot } from 'react-dom/client';
|
|
5
|
-
import { Router } from 'react-router-dom';
|
|
6
14
|
import { RecoilRoot } from 'recoil';
|
|
7
|
-
import {
|
|
8
|
-
import { ThemeProvider, theme } from '@darajs/styled-components';
|
|
15
|
+
import { ThemeProvider } from '@darajs/styled-components';
|
|
9
16
|
import { ErrorBoundary } from '@darajs/ui-components';
|
|
10
|
-
import {
|
|
11
|
-
import { GlobalTaskProvider } from './shared/context';
|
|
12
|
-
import { useUrlSync } from './shared/utils';
|
|
13
|
-
import AuthWrapper from './auth/auth-wrapper';
|
|
17
|
+
import { ConfigContextProvider, GlobalTaskProvider } from './shared/context';
|
|
14
18
|
import './index.css';
|
|
15
|
-
import
|
|
19
|
+
import RouterRoot from './router/router-root';
|
|
20
|
+
import { DirectionCtx, ImportersCtx, deferred, resolveTheme } from './shared';
|
|
21
|
+
import { preloadAuthComponent } from './shared/dynamic-component/dynamic-auth-component';
|
|
22
|
+
import { preloadComponents } from './shared/dynamic-component/dynamic-component';
|
|
23
|
+
import { preloadActions } from './shared/interactivity/use-action';
|
|
24
|
+
export function Root(props) {
|
|
25
|
+
return (_jsx(ConfigContextProvider, { initialConfig: props.daraData, children: _jsx(QueryClientProvider, { client: props.queryClient, children: _jsx(ThemeProvider, { theme: props.theme, children: _jsx(ErrorBoundary, { children: _jsx(ImportersCtx.Provider, { value: props.importers, children: _jsx(DirectionCtx.Provider, { value: { direction: 'row' }, children: _jsx(RecoilRoot, { children: _jsx(GlobalTaskProvider, { children: _jsx(RouterRoot, { daraData: props.daraData }) }) }) }) }) }) }) }) }));
|
|
26
|
+
}
|
|
16
27
|
/**
|
|
17
28
|
* The main run function for the JS half of the application creates a div and binds the react app onto the tree. It sets
|
|
18
29
|
* up a lot of context providers for the rest of the application. It accepts an object of importers as an argument. An
|
|
@@ -22,20 +33,26 @@ import { DirectionCtx, ImportersCtx, TemplateRoot } from './shared';
|
|
|
22
33
|
* @param importers - the importers object.
|
|
23
34
|
*/
|
|
24
35
|
function run(importers) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
var _a, _b;
|
|
38
|
+
const queryClient = new QueryClient();
|
|
39
|
+
const daraData = JSON.parse(document.getElementById('__DARA_DATA__').textContent);
|
|
40
|
+
document.title = daraData.title;
|
|
41
|
+
NProgress.configure({ showSpinner: false });
|
|
42
|
+
// ensure we have a deferred WS client
|
|
43
|
+
window.dara.ws = deferred();
|
|
44
|
+
yield Promise.all([
|
|
45
|
+
// preload auth components to prevent flashing of extra spinners
|
|
46
|
+
...Object.values(daraData.auth_components).map((component) => preloadAuthComponent(importers, component)),
|
|
47
|
+
// preload components and actions for the entire loaded registry
|
|
48
|
+
preloadComponents(importers, Object.values(daraData.components)),
|
|
49
|
+
preloadActions(importers, Object.values(daraData.actions)),
|
|
50
|
+
]);
|
|
51
|
+
const theme = resolveTheme((_a = daraData.theme) === null || _a === void 0 ? void 0 : _a.main, (_b = daraData.theme) === null || _b === void 0 ? void 0 : _b.base);
|
|
52
|
+
const container = document.getElementById('dara_root');
|
|
53
|
+
const root = createRoot(container);
|
|
54
|
+
root.render(_jsx(Root, { daraData: daraData, queryClient: queryClient, importers: importers, theme: theme }));
|
|
55
|
+
});
|
|
39
56
|
}
|
|
40
57
|
export default run;
|
|
41
58
|
//# sourceMappingURL=run.js.map
|
package/dist/run.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.js","sourceRoot":"","sources":["../js/run.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"run.js","sourceRoot":"","sources":["../js/run.tsx"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,SAAS,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAG7E,OAAO,aAAa,CAAC;AACrB,OAAO,UAAU,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAiB,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7F,OAAO,EAAE,oBAAoB,EAAE,MAAM,mDAAmD,CAAC;AACzF,OAAO,EAAE,iBAAiB,EAAE,MAAM,8CAA8C,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAcnE,MAAM,UAAU,IAAI,CAAC,KAKpB;IACG,OAAO,CACH,KAAC,qBAAqB,IAAC,aAAa,EAAE,KAAK,CAAC,QAAQ,YAChD,KAAC,mBAAmB,IAAC,MAAM,EAAE,KAAK,CAAC,WAAW,YAC1C,KAAC,aAAa,IAAC,KAAK,EAAE,KAAK,CAAC,KAAK,YAC7B,KAAC,aAAa,cACV,KAAC,YAAY,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,CAAC,SAAS,YACzC,KAAC,YAAY,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,YAC9C,KAAC,UAAU,cACP,KAAC,kBAAkB,cACf,KAAC,UAAU,IAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,GAAI,GACvB,GACZ,GACO,GACJ,GACZ,GACJ,GACE,GACF,CAC3B,CAAC;AACN,CAAC;AAED;;;;;;;GAOG;AACH,SAAe,GAAG,CAAC,SAA8C;;;QAC7D,MAAM,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC;QAEtC,MAAM,QAAQ,GAAa,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,cAAc,CAAC,eAAe,CAAE,CAAC,WAAY,CAAC,CAAC;QAE9F,QAAQ,CAAC,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC;QAChC,SAAS,CAAC,SAAS,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC;QAE5C,sCAAsC;QACtC,MAAM,CAAC,IAAI,CAAC,EAAE,GAAG,QAAQ,EAAE,CAAC;QAE5B,MAAM,OAAO,CAAC,GAAG,CAAC;YACd,gEAAgE;YAChE,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,oBAAoB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;YACzG,gEAAgE;YAChE,iBAAiB,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;YAChE,cAAc,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;QAEH,MAAM,KAAK,GAAG,YAAY,CAAC,MAAA,QAAQ,CAAC,KAAK,0CAAE,IAAI,EAAE,MAAA,QAAQ,CAAC,KAAK,0CAAE,IAAI,CAAC,CAAC;QAEvE,MAAM,SAAS,GAAG,QAAQ,CAAC,cAAc,CAAC,WAAW,CAAE,CAAC;QACxD,MAAM,IAAI,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC;QACnC,IAAI,CAAC,MAAM,CAAC,KAAC,IAAI,IAAC,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,GAAI,CAAC,CAAC;IAC5G,CAAC;CAAA;AAED,eAAe,GAAG,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Config } from '../../types';
|
|
2
|
+
export declare function ConfigContextProvider(props: {
|
|
3
|
+
initialConfig: Config;
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
}): React.ReactNode;
|
|
6
|
+
export declare function useConfig(): Config;
|
|
7
|
+
//# sourceMappingURL=config-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-context.d.ts","sourceRoot":"","sources":["../../../js/shared/context/config-context.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAQtC,wBAAgB,qBAAqB,CAAC,KAAK,EAAE;IAAE,aAAa,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,GAAG,KAAK,CAAC,SAAS,CAGlH;AAED,wBAAgB,SAAS,IAAI,MAAM,CAQlC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext, useMemo } from 'react';
|
|
3
|
+
const configContext = createContext(null);
|
|
4
|
+
export function ConfigContextProvider(props) {
|
|
5
|
+
const contextValue = useMemo(() => ({ config: props.initialConfig }), [props.initialConfig]);
|
|
6
|
+
return _jsx(configContext.Provider, { value: contextValue, children: props.children });
|
|
7
|
+
}
|
|
8
|
+
export function useConfig() {
|
|
9
|
+
const context = useContext(configContext);
|
|
10
|
+
if (!context) {
|
|
11
|
+
throw new Error('useConfigContext must be used within a ConfigContextProvider');
|
|
12
|
+
}
|
|
13
|
+
return context.config;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=config-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-context.js","sourceRoot":"","sources":["../../../js/shared/context/config-context.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAQ3D,MAAM,aAAa,GAAG,aAAa,CAAuB,IAAI,CAAC,CAAC;AAEhE,MAAM,UAAU,qBAAqB,CAAC,KAA2D;IAC7F,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,aAAa,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;IAC7F,OAAO,KAAC,aAAa,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY,YAAG,KAAK,CAAC,QAAQ,GAA0B,CAAC;AAClG,CAAC;AAED,MAAM,UAAU,SAAS;IACrB,MAAM,OAAO,GAAG,UAAU,CAAC,aAAa,CAAC,CAAC;IAE1C,IAAI,CAAC,OAAO,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,8DAA8D,CAAC,CAAC;IACpF,CAAC;IAED,OAAO,OAAO,CAAC,MAAM,CAAC;AAC1B,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
1
2
|
import { type GlobalTaskContext } from '../../types/core';
|
|
2
3
|
/**
|
|
3
4
|
* Represents a task run
|
|
@@ -9,7 +10,7 @@ export interface VariableTaskEntry {
|
|
|
9
10
|
triggerKey?: string;
|
|
10
11
|
}
|
|
11
12
|
interface GlobalTaskProviderProps {
|
|
12
|
-
children:
|
|
13
|
+
children: React.ReactNode;
|
|
13
14
|
tasks?: Set<string>;
|
|
14
15
|
variableTaskMap?: Map<string, Array<VariableTaskEntry>>;
|
|
15
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global-task-context.d.ts","sourceRoot":"","sources":["../../../js/shared/context/global-task-context.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"global-task-context.d.ts","sourceRoot":"","sources":["../../../js/shared/context/global-task-context.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAMtD;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAC9B,cAAc;IACd,MAAM,EAAE,MAAM,CAAC;IACf,gFAAgF;IAChF,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,UAAU,uBAAuB;IAC7B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACpB,eAAe,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAC;CAC3D;AAED,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,EAAE,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,EAAE,uBAAuB,GAAG,GAAG,CAAC,OAAO,CA4FrH;AAED,wBAAgB,cAAc,IAAI,iBAAiB,CAQlD"}
|
|
@@ -3,8 +3,9 @@ export { default as ImportersCtx } from './importers-context';
|
|
|
3
3
|
export { default as GlobalTaskProvider, useTaskContext } from './global-task-context';
|
|
4
4
|
export { default as VariableCtx } from './variable-context';
|
|
5
5
|
export { default as WebSocketCtx } from './websocket-context';
|
|
6
|
-
export {
|
|
6
|
+
export { RegistriesCtxProvider, useRegistriesCtx } from './registries-context';
|
|
7
7
|
export { default as DisplayCtx } from './display-context';
|
|
8
8
|
export { default as FallbackCtx } from './fallback-context';
|
|
9
9
|
export { default as RequestExtrasCtx, useRequestExtras, RequestExtrasProvider, PartialRequestExtrasProvider, } from './request-extras-context';
|
|
10
|
+
export { useConfig, ConfigContextProvider } from './config-context';
|
|
10
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../js/shared/context/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACtF,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../js/shared/context/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACtF,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EACH,OAAO,IAAI,gBAAgB,EAC3B,gBAAgB,EAChB,qBAAqB,EACrB,4BAA4B,GAC/B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -3,8 +3,9 @@ export { default as ImportersCtx } from './importers-context';
|
|
|
3
3
|
export { default as GlobalTaskProvider, useTaskContext } from './global-task-context';
|
|
4
4
|
export { default as VariableCtx } from './variable-context';
|
|
5
5
|
export { default as WebSocketCtx } from './websocket-context';
|
|
6
|
-
export {
|
|
6
|
+
export { RegistriesCtxProvider, useRegistriesCtx } from './registries-context';
|
|
7
7
|
export { default as DisplayCtx } from './display-context';
|
|
8
8
|
export { default as FallbackCtx } from './fallback-context';
|
|
9
9
|
export { default as RequestExtrasCtx, useRequestExtras, RequestExtrasProvider, PartialRequestExtrasProvider, } from './request-extras-context';
|
|
10
|
+
export { useConfig, ConfigContextProvider } from './config-context';
|
|
10
11
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../js/shared/context/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACtF,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../js/shared/context/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACtF,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EACH,OAAO,IAAI,gBAAgB,EAC3B,gBAAgB,EAChB,qBAAqB,EACrB,4BAA4B,GAC/B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import { RequestError } from '@darajs/ui-utils';
|
|
3
|
-
import { type ActionDef, type Component } from '../../types';
|
|
1
|
+
import { type ActionDef, type Component, type ComponentInstance } from '../../types';
|
|
4
2
|
type RegistriesCtx = {
|
|
5
3
|
/**
|
|
6
4
|
* Action registry
|
|
@@ -11,10 +9,15 @@ type RegistriesCtx = {
|
|
|
11
9
|
*/
|
|
12
10
|
componentRegistry: Record<string, Component>;
|
|
13
11
|
/**
|
|
14
|
-
* Callback to
|
|
12
|
+
* Callback to get a component from the components registry
|
|
15
13
|
*/
|
|
16
|
-
|
|
14
|
+
getComponent: (instance: ComponentInstance) => Promise<Component>;
|
|
17
15
|
};
|
|
18
|
-
declare
|
|
19
|
-
|
|
16
|
+
export declare function RegistriesCtxProvider(props: {
|
|
17
|
+
componentRegistry: Record<string, Component>;
|
|
18
|
+
actionRegistry: Record<string, ActionDef>;
|
|
19
|
+
children: React.ReactNode;
|
|
20
|
+
}): React.ReactNode;
|
|
21
|
+
export declare function useRegistriesCtx(): RegistriesCtx;
|
|
22
|
+
export {};
|
|
20
23
|
//# sourceMappingURL=registries-context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registries-context.d.ts","sourceRoot":"","sources":["../../../js/shared/context/registries-context.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"registries-context.d.ts","sourceRoot":"","sources":["../../../js/shared/context/registries-context.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,KAAK,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAIjF,KAAK,aAAa,GAAG;IACjB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAC1C;;OAEG;IACH,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAC7C;;OAEG;IACH,YAAY,EAAE,CAAC,QAAQ,EAAE,iBAAiB,KAAK,OAAO,CAAC,SAAS,CAAC,CAAC;CACrE,CAAC;AAIF,wBAAgB,qBAAqB,CAAC,KAAK,EAAE;IACzC,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAC7C,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAC1C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC7B,GAAG,KAAK,CAAC,SAAS,CA0ClB;AAED,wBAAgB,gBAAgB,IAAI,aAAa,CAQhD"}
|
|
@@ -1,11 +1,51 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
import { useMutation } from '@tanstack/react-query';
|
|
12
|
+
import { createContext, useCallback, useContext, useMemo, useState } from 'react';
|
|
13
|
+
import { HTTP_METHOD, validateResponse } from '@darajs/ui-utils';
|
|
14
|
+
import { request } from '../../api/http';
|
|
15
|
+
import { handleAuthErrors } from '../../auth/auth';
|
|
4
16
|
import {} from '../../types';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
17
|
+
import { useRequestExtras } from './request-extras-context';
|
|
18
|
+
const registriesCtx = createContext(null);
|
|
19
|
+
export function RegistriesCtxProvider(props) {
|
|
20
|
+
const [actionRegistry] = useState(props.actionRegistry);
|
|
21
|
+
const [componentRegistry, setComponentRegistry] = useState(props.componentRegistry);
|
|
22
|
+
const extras = useRequestExtras();
|
|
23
|
+
const refetchComponentMutation = useMutation({
|
|
24
|
+
mutationKey: ['component-definition'],
|
|
25
|
+
mutationFn: (_a) => __awaiter(this, [_a], void 0, function* ({ name }) {
|
|
26
|
+
const response = yield request(`/api/core/components/${name}/definition`, { method: HTTP_METHOD.GET }, extras);
|
|
27
|
+
yield handleAuthErrors(response, true);
|
|
28
|
+
yield validateResponse(response, `Failed to fetch the component definition for ${name}, was it registered in the app?`);
|
|
29
|
+
return response.json();
|
|
30
|
+
}),
|
|
31
|
+
retry: 3,
|
|
32
|
+
});
|
|
33
|
+
const getComponent = useCallback((instance) => __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
if (componentRegistry[instance.name]) {
|
|
35
|
+
return componentRegistry[instance.name];
|
|
36
|
+
}
|
|
37
|
+
const component = yield refetchComponentMutation.mutateAsync({ name: instance.name });
|
|
38
|
+
setComponentRegistry((prev) => (Object.assign(Object.assign({}, prev), { [instance.name]: component })));
|
|
39
|
+
return component;
|
|
40
|
+
}), [componentRegistry, refetchComponentMutation]);
|
|
41
|
+
const contextValue = useMemo(() => ({ actionRegistry, componentRegistry, getComponent }), [actionRegistry, componentRegistry, getComponent]);
|
|
42
|
+
return _jsx(registriesCtx.Provider, { value: contextValue, children: props.children });
|
|
43
|
+
}
|
|
44
|
+
export function useRegistriesCtx() {
|
|
45
|
+
const context = useContext(registriesCtx);
|
|
46
|
+
if (!context) {
|
|
47
|
+
throw new Error('useRegistriesCtx must be used within a RegistriesCtxProvider');
|
|
48
|
+
}
|
|
49
|
+
return context;
|
|
50
|
+
}
|
|
11
51
|
//# sourceMappingURL=registries-context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registries-context.js","sourceRoot":"","sources":["../../../js/shared/context/registries-context.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"registries-context.js","sourceRoot":"","sources":["../../../js/shared/context/registries-context.tsx"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAElF,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEjE,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAA0D,MAAM,SAAS,CAAC;AAEjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAiB5D,MAAM,aAAa,GAAG,aAAa,CAAuB,IAAI,CAAC,CAAC;AAEhE,MAAM,UAAU,qBAAqB,CAAC,KAIrC;IACG,MAAM,CAAC,cAAc,CAAC,GAAG,QAAQ,CAA4B,KAAK,CAAC,cAAc,CAAC,CAAC;IACnF,MAAM,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,GAAG,QAAQ,CAA4B,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAC/G,MAAM,MAAM,GAAG,gBAAgB,EAAE,CAAC;IAElC,MAAM,wBAAwB,GAAG,WAAW,CAAqC;QAC7E,WAAW,EAAE,CAAC,sBAAsB,CAAC;QACrC,UAAU,EAAE,KAAiB,EAAE,0CAAZ,EAAE,IAAI,EAAE;YACvB,MAAM,QAAQ,GAAG,MAAM,OAAO,CAC1B,wBAAwB,IAAI,aAAa,EACzC,EAAE,MAAM,EAAE,WAAW,CAAC,GAAG,EAAE,EAC3B,MAAM,CACT,CAAC;YACF,MAAM,gBAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;YACvC,MAAM,gBAAgB,CAClB,QAAQ,EACR,gDAAgD,IAAI,iCAAiC,CACxF,CAAC;YACF,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;QAC3B,CAAC,CAAA;QACD,KAAK,EAAE,CAAC;KACX,CAAC,CAAC;IAEH,MAAM,YAAY,GAAG,WAAW,CAC5B,CAAO,QAA2B,EAAsB,EAAE;QACtD,IAAI,iBAAiB,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YACnC,OAAO,iBAAiB,CAAC,QAAQ,CAAC,IAAI,CAAE,CAAC;QAC7C,CAAC;QAED,MAAM,SAAS,GAAG,MAAM,wBAAwB,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;QACtF,oBAAoB,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,iCAAM,IAAI,KAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,IAAG,CAAC,CAAC;QAC1E,OAAO,SAAS,CAAC;IACrB,CAAC,CAAA,EACD,CAAC,iBAAiB,EAAE,wBAAwB,CAAC,CAChD,CAAC;IAEF,MAAM,YAAY,GAAG,OAAO,CACxB,GAAG,EAAE,CAAC,CAAC,EAAE,cAAc,EAAE,iBAAiB,EAAE,YAAY,EAAE,CAAC,EAC3D,CAAC,cAAc,EAAE,iBAAiB,EAAE,YAAY,CAAC,CACpD,CAAC;IAEF,OAAO,KAAC,aAAa,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY,YAAG,KAAK,CAAC,QAAQ,GAA0B,CAAC;AAClG,CAAC;AAED,MAAM,UAAU,gBAAgB;IAC5B,MAAM,OAAO,GAAG,UAAU,CAAC,aAAa,CAAC,CAAC;IAE1C,IAAI,CAAC,OAAO,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,8DAA8D,CAAC,CAAC;IACpF,CAAC;IAED,OAAO,OAAO,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { AuthComponent, ModuleContent } from '../../types/core';
|
|
2
|
+
export declare function preloadAuthComponent(importers: Record<string, () => Promise<ModuleContent>>, component: AuthComponent): Promise<void>;
|
|
3
|
+
/**
|
|
4
|
+
* Simplified version of DynamicComponent, just for the auth components.
|
|
5
|
+
* This is because we can't use the component registry for auth components, since the component registry operates
|
|
6
|
+
* in an authenticated context, and we need to be able to render the login page without being authenticated.
|
|
7
|
+
*/
|
|
8
|
+
declare function DynamicAuthComponent(props: {
|
|
9
|
+
component: AuthComponent;
|
|
10
|
+
}): React.ReactNode;
|
|
11
|
+
export default DynamicAuthComponent;
|
|
12
|
+
//# sourceMappingURL=dynamic-auth-component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dynamic-auth-component.d.ts","sourceRoot":"","sources":["../../../js/shared/dynamic-component/dynamic-auth-component.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAQjE,wBAAsB,oBAAoB,CACtC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC,aAAa,CAAC,CAAC,EACvD,SAAS,EAAE,aAAa,GACzB,OAAO,CAAC,IAAI,CAAC,CAyBf;AAED;;;;GAIG;AACH,iBAAS,oBAAoB,CAAC,KAAK,EAAE;IAAE,SAAS,EAAE,aAAa,CAAA;CAAE,GAAG,KAAK,CAAC,SAAS,CAOlF;AAED,eAAe,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
import {} from 'react';
|
|
12
|
+
const PRELOADED_COMPONENTS = {};
|
|
13
|
+
function getIdentifier(component) {
|
|
14
|
+
return `${component.py_module}.${component.js_name}`;
|
|
15
|
+
}
|
|
16
|
+
export function preloadAuthComponent(importers, component) {
|
|
17
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
const importer = importers[component.py_module];
|
|
19
|
+
if (!importer) {
|
|
20
|
+
throw new Error(`Missing importer for module ${component.py_module}`);
|
|
21
|
+
}
|
|
22
|
+
let moduleContent = null;
|
|
23
|
+
try {
|
|
24
|
+
moduleContent = yield importer();
|
|
25
|
+
}
|
|
26
|
+
catch (err) {
|
|
27
|
+
throw new Error(`Failed to import module ${component.py_module}`, err);
|
|
28
|
+
}
|
|
29
|
+
if (!moduleContent) {
|
|
30
|
+
throw new Error(`Failed to import module ${component.py_module}`);
|
|
31
|
+
}
|
|
32
|
+
const Component = moduleContent[component.js_name];
|
|
33
|
+
if (!Component) {
|
|
34
|
+
throw new Error(`Failed to import component ${component.js_name} from module ${component.py_module}`);
|
|
35
|
+
}
|
|
36
|
+
PRELOADED_COMPONENTS[getIdentifier(component)] = _jsx(Component, {});
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Simplified version of DynamicComponent, just for the auth components.
|
|
41
|
+
* This is because we can't use the component registry for auth components, since the component registry operates
|
|
42
|
+
* in an authenticated context, and we need to be able to render the login page without being authenticated.
|
|
43
|
+
*/
|
|
44
|
+
function DynamicAuthComponent(props) {
|
|
45
|
+
const identifier = getIdentifier(props.component);
|
|
46
|
+
// should not happen
|
|
47
|
+
if (!(identifier in PRELOADED_COMPONENTS)) {
|
|
48
|
+
throw new Error(`Component ${identifier} not found`);
|
|
49
|
+
}
|
|
50
|
+
return PRELOADED_COMPONENTS[identifier];
|
|
51
|
+
}
|
|
52
|
+
export default DynamicAuthComponent;
|
|
53
|
+
//# sourceMappingURL=dynamic-auth-component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dynamic-auth-component.js","sourceRoot":"","sources":["../../../js/shared/dynamic-component/dynamic-auth-component.tsx"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,EAAsC,MAAM,OAAO,CAAC;AAI3D,MAAM,oBAAoB,GAA8B,EAAE,CAAC;AAE3D,SAAS,aAAa,CAAC,SAAwB;IAC3C,OAAO,GAAG,SAAS,CAAC,SAAS,IAAI,SAAS,CAAC,OAAO,EAAE,CAAC;AACzD,CAAC;AAED,MAAM,UAAgB,oBAAoB,CACtC,SAAuD,EACvD,SAAwB;;QAExB,MAAM,QAAQ,GAAG,SAAS,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QAEhD,IAAI,CAAC,QAAQ,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CAAC,+BAA+B,SAAS,CAAC,SAAS,EAAE,CAAC,CAAC;QAC1E,CAAC;QAED,IAAI,aAAa,GAAQ,IAAI,CAAC;QAE9B,IAAI,CAAC;YACD,aAAa,GAAG,MAAM,QAAQ,EAAE,CAAC;QACrC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACX,MAAM,IAAI,KAAK,CAAC,2BAA2B,SAAS,CAAC,SAAS,EAAE,EAAE,GAAY,CAAC,CAAC;QACpF,CAAC;QACD,IAAI,CAAC,aAAa,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,2BAA2B,SAAS,CAAC,SAAS,EAAE,CAAC,CAAC;QACtE,CAAC;QAED,MAAM,SAAS,GAAG,aAAa,CAAC,SAAS,CAAC,OAAO,CAA8B,CAAC;QAEhF,IAAI,CAAC,SAAS,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,8BAA8B,SAAS,CAAC,OAAO,gBAAgB,SAAS,CAAC,SAAS,EAAE,CAAC,CAAC;QAC1G,CAAC;QAED,oBAAoB,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,GAAG,KAAC,SAAS,KAAG,CAAC;IACnE,CAAC;CAAA;AAED;;;;GAIG;AACH,SAAS,oBAAoB,CAAC,KAAmC;IAC7D,MAAM,UAAU,GAAG,aAAa,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IAClD,oBAAoB;IACpB,IAAI,CAAC,CAAC,UAAU,IAAI,oBAAoB,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,aAAa,UAAU,YAAY,CAAC,CAAC;IACzD,CAAC;IACD,OAAO,oBAAoB,CAAC,UAAU,CAAE,CAAC;AAC7C,CAAC;AAED,eAAe,oBAAoB,CAAC"}
|
|
@@ -1,9 +1,18 @@
|
|
|
1
|
-
import { type ComponentInstance } from '../../types';
|
|
1
|
+
import { type Component, type ComponentInstance } from '../../types';
|
|
2
|
+
import { type ModuleContent } from '../../types/core';
|
|
2
3
|
/**
|
|
3
4
|
* Clear the caches for testing.
|
|
4
5
|
* In prod we don't want to clear ever
|
|
5
6
|
*/
|
|
6
7
|
export declare function clearCaches_TEST(): void;
|
|
8
|
+
/**
|
|
9
|
+
* Pre-warm the caches for the given components.
|
|
10
|
+
* This is useful to pre-warm the core components on startup to avoid spinners
|
|
11
|
+
*
|
|
12
|
+
* @param importers - the importers object.
|
|
13
|
+
* @param components - the components to pre-warm
|
|
14
|
+
*/
|
|
15
|
+
export declare function preloadComponents(importers: Record<string, () => Promise<ModuleContent>>, components: Component[]): Promise<void>;
|
|
7
16
|
interface DynamicComponentProps {
|
|
8
17
|
/** The component instance to inject */
|
|
9
18
|
component: ComponentInstance | null | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-component.d.ts","sourceRoot":"","sources":["../../../js/shared/dynamic-component/dynamic-component.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dynamic-component.d.ts","sourceRoot":"","sources":["../../../js/shared/dynamic-component/dynamic-component.tsx"],"names":[],"mappings":"AAyBA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,iBAAiB,EAA2C,MAAM,SAAS,CAAC;AAC1G,OAAO,EAAoB,KAAK,aAAa,EAA8C,MAAM,cAAc,CAAC;AA6DhH;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAGvC;AAED;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACnC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC,aAAa,CAAC,CAAC,EACvD,UAAU,EAAE,SAAS,EAAE,GACxB,OAAO,CAAC,IAAI,CAAC,CA6Cf;AA4ID,UAAU,qBAAqB;IAC3B,uCAAuC;IACvC,SAAS,EAAE,iBAAiB,GAAG,IAAI,GAAG,SAAS,CAAC;CACnD;AA8BD;;;;;;;GAOG;AACH,iBAAS,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,KAAK,CAAC,SAAS,CA0IvE;;AAkED,wBAAsC"}
|
|
@@ -8,16 +8,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
11
|
+
import groupBy from 'lodash/groupBy';
|
|
12
|
+
import partition from 'lodash/partition';
|
|
11
13
|
import { Suspense, memo, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState, } from 'react';
|
|
12
14
|
import { ErrorBoundary } from 'react-error-boundary';
|
|
15
|
+
import { useLatestRef } from '@darajs/ui-utils';
|
|
13
16
|
import DefaultFallback from '../../components/fallback/default';
|
|
14
17
|
import { hasMarkers } from '../../components/for/templating';
|
|
15
|
-
import ProgressTracker from '../../components/progress-tracker
|
|
16
|
-
import { FallbackCtx, ImportersCtx, VariableCtx, useTaskContext } from '../../shared/context';
|
|
18
|
+
import ProgressTracker from '../../components/progress-tracker';
|
|
19
|
+
import { FallbackCtx, ImportersCtx, VariableCtx, useRegistriesCtx, useTaskContext } from '../../shared/context';
|
|
17
20
|
import { ErrorDisplay, isSelectorError } from '../../shared/error-handling';
|
|
18
21
|
import { useRefreshSelector } from '../../shared/interactivity';
|
|
19
22
|
import useServerComponent, { useRefreshServerComponent } from '../../shared/interactivity/use-server-component';
|
|
20
|
-
import { isJsComponent,
|
|
23
|
+
import { isJsComponent, useInterval } from '../../shared/utils';
|
|
21
24
|
import { isDerivedVariable } from '../../types';
|
|
22
25
|
import { UserError, isInvalidComponent, isRawString } from '../../types/core';
|
|
23
26
|
import { cleanProps } from './clean-props';
|
|
@@ -76,6 +79,56 @@ export function clearCaches_TEST() {
|
|
|
76
79
|
MODULE_CACHE.clear();
|
|
77
80
|
COMPONENT_METADATA_CACHE.clear();
|
|
78
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* Pre-warm the caches for the given components.
|
|
84
|
+
* This is useful to pre-warm the core components on startup to avoid spinners
|
|
85
|
+
*
|
|
86
|
+
* @param importers - the importers object.
|
|
87
|
+
* @param components - the components to pre-warm
|
|
88
|
+
*/
|
|
89
|
+
export function preloadComponents(importers, components) {
|
|
90
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
91
|
+
const [jsComponents, pyComponents] = partition(components, isJsComponent);
|
|
92
|
+
// for py-components we just add a metadata cache entry
|
|
93
|
+
for (const component of pyComponents) {
|
|
94
|
+
if (COMPONENT_METADATA_CACHE.has(component.name)) {
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
COMPONENT_METADATA_CACHE.set(component.name, component);
|
|
98
|
+
}
|
|
99
|
+
const componentsByModule = groupBy(jsComponents, (component) => component.py_module);
|
|
100
|
+
// for js-components we load the module and pre-load the components
|
|
101
|
+
for (const [pyModule, componentsInModule] of Object.entries(componentsByModule)) {
|
|
102
|
+
if (MODULE_CACHE.has(pyModule)) {
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
// Load module
|
|
106
|
+
const importer = importers[pyModule];
|
|
107
|
+
if (!importer) {
|
|
108
|
+
throw new Error(`Missing importer for module ${pyModule}`);
|
|
109
|
+
}
|
|
110
|
+
let moduleContent = null;
|
|
111
|
+
try {
|
|
112
|
+
// there will be at most a couple of modules, fine to do serially
|
|
113
|
+
// eslint-disable-next-line no-await-in-loop
|
|
114
|
+
moduleContent = yield importer();
|
|
115
|
+
if (moduleContent) {
|
|
116
|
+
MODULE_CACHE.set(pyModule, moduleContent);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
catch (e) {
|
|
120
|
+
throw new Error(`Failed to load module ${pyModule}: ${String(e)}`);
|
|
121
|
+
}
|
|
122
|
+
// pre-load components
|
|
123
|
+
for (const component of componentsInModule) {
|
|
124
|
+
if (COMPONENT_METADATA_CACHE.has(component.name)) {
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
COMPONENT_METADATA_CACHE.set(component.name, component);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
}
|
|
79
132
|
/**
|
|
80
133
|
* Try resolving component synchronously from cache
|
|
81
134
|
*/
|
|
@@ -129,7 +182,13 @@ function resolveComponentAsync(component, getComponent, importers) {
|
|
|
129
182
|
return;
|
|
130
183
|
}
|
|
131
184
|
// Get component entry from registry
|
|
132
|
-
|
|
185
|
+
let entry;
|
|
186
|
+
try {
|
|
187
|
+
entry = yield getComponent(component);
|
|
188
|
+
}
|
|
189
|
+
catch (e) {
|
|
190
|
+
throw new ComponentLoadError(e instanceof Error ? e.message : String(e), 'Failed to load component');
|
|
191
|
+
}
|
|
133
192
|
if (!isJsComponent(entry)) {
|
|
134
193
|
// Python component, just cache metadata and nothing else to do here
|
|
135
194
|
COMPONENT_METADATA_CACHE.set(component.name, entry);
|
|
@@ -203,7 +262,7 @@ function DynamicComponent(props) {
|
|
|
203
262
|
var _a, _b, _c, _d, _e, _f;
|
|
204
263
|
const importers = useContext(ImportersCtx);
|
|
205
264
|
const fallbackCtx = useContext(FallbackCtx);
|
|
206
|
-
const {
|
|
265
|
+
const { getComponent } = useRegistriesCtx();
|
|
207
266
|
// Try sync resolution first
|
|
208
267
|
const [component, setComponent] = useState(() => resolveComponentSync(props.component));
|
|
209
268
|
const [isLoading, setIsLoading] = useState(() => component === null);
|
|
@@ -242,13 +301,14 @@ function DynamicComponent(props) {
|
|
|
242
301
|
setLoadingStarted(false);
|
|
243
302
|
}
|
|
244
303
|
}, [props.component]);
|
|
304
|
+
const getComponentStable = useLatestRef(getComponent);
|
|
245
305
|
// Async loading effect
|
|
246
306
|
useEffect(() => {
|
|
247
307
|
if (!isLoading || loadingStarted) {
|
|
248
308
|
return;
|
|
249
309
|
}
|
|
250
310
|
setLoadingStarted(true);
|
|
251
|
-
resolveComponentAsync(props.component,
|
|
311
|
+
resolveComponentAsync(props.component, getComponentStable.current, importers)
|
|
252
312
|
.then(() => {
|
|
253
313
|
// Try sync resolution again after async loading
|
|
254
314
|
const resolvedComponent = resolveComponentSync(props.component);
|
|
@@ -263,7 +323,7 @@ function DynamicComponent(props) {
|
|
|
263
323
|
setComponent(_jsx(ErrorDisplay, { config: { title: error.title, description: error.message } }));
|
|
264
324
|
}
|
|
265
325
|
});
|
|
266
|
-
}, [props.component,
|
|
326
|
+
}, [props.component, getComponentStable, importers, isLoading, loadingStarted]);
|
|
267
327
|
const refreshSelector = useRefreshSelector();
|
|
268
328
|
function onResetErrorBoundary(error) {
|
|
269
329
|
if (isSelectorError(error)) {
|