@xyo-network/os-react-runtime 4.2.0-rc.8 → 4.2.0
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/browser/index.mjs +16 -15
- package/dist/browser/index.mjs.map +1 -1
- package/dist/browser/modules/Dapp/modules/Window/hooks/route/helpers/useManageDappInjectableParamsFromRoute.d.ts.map +1 -1
- package/dist/browser/modules/Dapp/modules/Window/hooks/route/helpers/useManageDappPathFromRoute.d.ts +1 -1
- package/dist/browser/modules/Dapp/modules/Window/hooks/route/helpers/useManageDappPathFromRoute.d.ts.map +1 -1
- package/package.json +10 -11
- package/src/DappPathSwitcher.tsx +3 -3
- package/src/modules/Dapp/modules/Window/DappWindow.tsx +3 -3
- package/src/modules/Dapp/modules/Window/hooks/route/helpers/useManageDappInjectableParamsFromRoute.tsx +3 -6
- package/src/modules/Dapp/modules/Window/hooks/route/helpers/useManageDappPathFromRoute.tsx +3 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useManageDappInjectableParamsFromRoute.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/modules/Dapp/modules/Window/hooks/route/helpers/useManageDappInjectableParamsFromRoute.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"useManageDappInjectableParamsFromRoute.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/modules/Dapp/modules/Window/hooks/route/helpers/useManageDappInjectableParamsFromRoute.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAKxD,6FAA6F;AAC7F,eAAO,MAAM,sCAAsC,aAAc,WAAW,GAAG,IAAI,0BA6ClF,CAAA"}
|
package/dist/browser/modules/Dapp/modules/Window/hooks/route/helpers/useManageDappPathFromRoute.d.ts
CHANGED
|
@@ -11,5 +11,5 @@ import type { XyOsContext } from '@xyo-network/os-model';
|
|
|
11
11
|
* 5. Navigating directly to a path from within the dApp by clicking back
|
|
12
12
|
*/
|
|
13
13
|
/** React to changes in the `path` route param */
|
|
14
|
-
export declare const useManageDappPathFromRoute: (context?: XyOsContext | null, dappName?: string) =>
|
|
14
|
+
export declare const useManageDappPathFromRoute: (context?: XyOsContext | null, dappName?: string) => Error | undefined;
|
|
15
15
|
//# sourceMappingURL=useManageDappPathFromRoute.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useManageDappPathFromRoute.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/modules/Dapp/modules/Window/hooks/route/helpers/useManageDappPathFromRoute.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAUxD;;;;;;;;;;GAUG;AAEH,iDAAiD;AACjD,eAAO,MAAM,0BAA0B,aAAc,WAAW,GAAG,IAAI,aAAa,MAAM,
|
|
1
|
+
{"version":3,"file":"useManageDappPathFromRoute.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/modules/Dapp/modules/Window/hooks/route/helpers/useManageDappPathFromRoute.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAUxD;;;;;;;;;;GAUG;AAEH,iDAAiD;AACjD,eAAO,MAAM,0BAA0B,aAAc,WAAW,GAAG,IAAI,aAAa,MAAM,sBAmDzF,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/os-react-runtime",
|
|
3
|
-
"version": "4.2.0
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"description": "Primary SDK for using XYO Protocol 2.0",
|
|
5
5
|
"homepage": "https://xyo.network",
|
|
6
6
|
"bugs": {
|
|
@@ -48,23 +48,23 @@
|
|
|
48
48
|
"@xylabs/react-shared": "^5.3.14",
|
|
49
49
|
"@xyo-network/archivist-indexeddb": "^3.6.6",
|
|
50
50
|
"@xyo-network/archivist-model": "^3.6.6",
|
|
51
|
-
"@xyo-network/bios-browser": "^4.2.0
|
|
52
|
-
"@xyo-network/bios-model": "^4.2.0
|
|
51
|
+
"@xyo-network/bios-browser": "^4.2.0",
|
|
52
|
+
"@xyo-network/bios-model": "^4.2.0",
|
|
53
53
|
"@xyo-network/diviner-boundwitness-indexeddb": "^3.6.6",
|
|
54
54
|
"@xyo-network/diviner-model": "^3.6.6",
|
|
55
55
|
"@xyo-network/diviner-payload-generic": "^3.6.6",
|
|
56
56
|
"@xyo-network/diviner-payload-indexeddb": "^3.6.6",
|
|
57
57
|
"@xyo-network/diviner-payload-model": "^3.6.6",
|
|
58
|
-
"@xyo-network/kernel": "^4.2.0
|
|
59
|
-
"@xyo-network/kernel-model": "^4.2.0
|
|
58
|
+
"@xyo-network/kernel": "^4.2.0",
|
|
59
|
+
"@xyo-network/kernel-model": "^4.2.0",
|
|
60
60
|
"@xyo-network/module-event-emitter": "^3.6.6",
|
|
61
61
|
"@xyo-network/module-events": "^3.6.6",
|
|
62
62
|
"@xyo-network/module-factory-locator": "^3.6.6",
|
|
63
63
|
"@xyo-network/node-model": "^3.6.6",
|
|
64
|
-
"@xyo-network/os-model": "^4.2.0
|
|
65
|
-
"@xyo-network/os-react-debug": "^4.2.0
|
|
66
|
-
"@xyo-network/os-react-model": "^4.2.0
|
|
67
|
-
"@xyo-network/os-runtime": "^4.2.0
|
|
64
|
+
"@xyo-network/os-model": "^4.2.0",
|
|
65
|
+
"@xyo-network/os-react-debug": "^4.2.0",
|
|
66
|
+
"@xyo-network/os-react-model": "^4.2.0",
|
|
67
|
+
"@xyo-network/os-runtime": "^4.2.0",
|
|
68
68
|
"@xyo-network/payload-model": "^3.6.6",
|
|
69
69
|
"@xyo-network/react-archivist": "^4.3.1",
|
|
70
70
|
"@xyo-network/react-card": "^4.3.1",
|
|
@@ -112,6 +112,5 @@
|
|
|
112
112
|
},
|
|
113
113
|
"publishConfig": {
|
|
114
114
|
"access": "public"
|
|
115
|
-
}
|
|
116
|
-
"stableVersion": "4.1.4"
|
|
115
|
+
}
|
|
117
116
|
}
|
package/src/DappPathSwitcher.tsx
CHANGED
|
@@ -25,7 +25,7 @@ export const DappPathSwitcher: React.FC<DappPathSwitcherProps> = ({ activePath,
|
|
|
25
25
|
|
|
26
26
|
return (
|
|
27
27
|
<>
|
|
28
|
-
{transitions((transitionProps,
|
|
28
|
+
{transitions((transitionProps, activePathRef) => (
|
|
29
29
|
<animated.div
|
|
30
30
|
style={{
|
|
31
31
|
...transitionProps,
|
|
@@ -44,11 +44,11 @@ export const DappPathSwitcher: React.FC<DappPathSwitcherProps> = ({ activePath,
|
|
|
44
44
|
}}
|
|
45
45
|
>
|
|
46
46
|
{(() => {
|
|
47
|
-
const activeIndex = pathToComponent?.findIndex(({ path: componentPath }) =>
|
|
47
|
+
const activeIndex = pathToComponent?.findIndex(({ path: componentPath }) => activePathRef === componentPath)
|
|
48
48
|
const activeItem = pathToComponent && activeIndex !== -1 && activeIndex !== undefined ? pathToComponent[activeIndex] : undefined
|
|
49
49
|
return activeItem
|
|
50
50
|
? activeItem.component
|
|
51
|
-
: <ErrorRender error={new Error(`No component found for path: ${
|
|
51
|
+
: <ErrorRender error={new Error(`No component found for path: ${activePathRef}`)} scope="DappPathSwitcher" />
|
|
52
52
|
})()}
|
|
53
53
|
</animated.div>
|
|
54
54
|
))}
|
|
@@ -45,14 +45,14 @@ export const DappWindow: React.FC<DappWindowProps> = ({
|
|
|
45
45
|
}>, [])
|
|
46
46
|
|
|
47
47
|
useSyncOsRegisteredAccessInterfaces(context)
|
|
48
|
-
useManageDappPathFromRoute(context, name)
|
|
49
|
-
useManageDappInjectableParamsFromRoute(context)
|
|
48
|
+
const routingError = useManageDappPathFromRoute(context, name)
|
|
49
|
+
const injectableErrors = useManageDappInjectableParamsFromRoute(context)
|
|
50
50
|
|
|
51
51
|
const {
|
|
52
52
|
activePath, error: menuError, menuConfig, menuItemsVisible, onPathChange,
|
|
53
53
|
} = useDappMenu(context, name)
|
|
54
54
|
|
|
55
|
-
const resolvedErrors = [nodeCreateError, menuError, ...(errors ?? [])].filter(Boolean)
|
|
55
|
+
const resolvedErrors = [...injectableErrors, routingError, nodeCreateError, menuError, ...(errors ?? [])].filter(Boolean)
|
|
56
56
|
const hasErrors = resolvedErrors.length > 0
|
|
57
57
|
|
|
58
58
|
return (
|
|
@@ -5,23 +5,20 @@ import { asArchivistInstance } from '@xyo-network/archivist-model'
|
|
|
5
5
|
import type { XyOsContext } from '@xyo-network/os-model'
|
|
6
6
|
import { isDappInjectableParams } from '@xyo-network/os-model'
|
|
7
7
|
import { DappCaller } from '@xyo-network/os-runtime'
|
|
8
|
-
import {
|
|
9
|
-
useNavigate, useParams, useSearchParams,
|
|
10
|
-
} from 'react-router-dom'
|
|
8
|
+
import { useNavigate, useSearchParams } from 'react-router-dom'
|
|
11
9
|
|
|
12
10
|
/** Update the dapp archivist with injectable params based off changes in the query params */
|
|
13
11
|
export const useManageDappInjectableParamsFromRoute = (context?: XyOsContext | null) => {
|
|
14
12
|
const [queryParams] = useSearchParams()
|
|
15
|
-
const params = useParams()
|
|
16
13
|
const navigate = useNavigate()
|
|
17
14
|
|
|
18
15
|
const [, callerError] = usePromise(async () => {
|
|
19
|
-
if (context &&
|
|
16
|
+
if (context && queryParams) {
|
|
20
17
|
const dappCaller = new DappCaller(context)
|
|
21
18
|
const pathname = globalThis.location.pathname
|
|
22
19
|
await dappCaller.setDappInjectableRouteParams(queryParams, pathname)
|
|
23
20
|
}
|
|
24
|
-
}, [context, queryParams
|
|
21
|
+
}, [context, queryParams])
|
|
25
22
|
|
|
26
23
|
// Update the route if the dapp inserts a new injectable params payload and the path is different
|
|
27
24
|
const [, listenerError] = usePromise(async () => {
|
|
@@ -65,10 +65,12 @@ export const useManageDappPathFromRoute = (context?: XyOsContext | null, dappNam
|
|
|
65
65
|
}, [dappName, context, defaultPath, menuSelection])
|
|
66
66
|
|
|
67
67
|
// Sync the menu archivist when the route changes (no menuSelection dependency)
|
|
68
|
-
usePromise(async () => {
|
|
68
|
+
const [, updateErrors] = usePromise(async () => {
|
|
69
69
|
if (context && pathParam !== currentPathRef.current) {
|
|
70
70
|
await updateMenuArchivist(pathParam)
|
|
71
71
|
currentPathRef.current = pathParam
|
|
72
72
|
}
|
|
73
73
|
}, [context, pathParam, updateMenuArchivist])
|
|
74
|
+
|
|
75
|
+
return updateErrors
|
|
74
76
|
}
|