@arcblock/ux 2.7.19 → 2.7.20
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.
@@ -22,7 +22,7 @@ function BlockletProvider({
|
|
22
22
|
const [blockletData, setBlockletData] = useState(null);
|
23
23
|
const getBlockleData = useMemoizedFn(async () => {
|
24
24
|
if (!baseUrl || window.location.href.startsWith(baseUrl)) {
|
25
|
-
|
25
|
+
throw new Error('no blocklet data');
|
26
26
|
}
|
27
27
|
const url = new URL('__blocklet__.js', baseUrl);
|
28
28
|
url.searchParams.set('type', 'json');
|
@@ -36,7 +36,8 @@ function BlockletProvider({
|
|
36
36
|
setBlockletData(data);
|
37
37
|
} catch {
|
38
38
|
// NOTICE: 如果获取指定 blockletData 失败,则使用 window.blocklet
|
39
|
-
|
39
|
+
const data = window.blocklet || window.env;
|
40
|
+
setBlockletData(data);
|
40
41
|
}
|
41
42
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
42
43
|
}, [baseUrl]);
|
@@ -34,7 +34,7 @@ function BlockletProvider(_ref) {
|
|
34
34
|
const [blockletData, setBlockletData] = (0, _react.useState)(null);
|
35
35
|
const getBlockleData = (0, _ahooks.useMemoizedFn)(async () => {
|
36
36
|
if (!baseUrl || window.location.href.startsWith(baseUrl)) {
|
37
|
-
|
37
|
+
throw new Error('no blocklet data');
|
38
38
|
}
|
39
39
|
const url = new URL('__blocklet__.js', baseUrl);
|
40
40
|
url.searchParams.set('type', 'json');
|
@@ -48,7 +48,8 @@ function BlockletProvider(_ref) {
|
|
48
48
|
setBlockletData(data);
|
49
49
|
} catch (_unused) {
|
50
50
|
// NOTICE: 如果获取指定 blockletData 失败,则使用 window.blocklet
|
51
|
-
|
51
|
+
const data = window.blocklet || window.env;
|
52
|
+
setBlockletData(data);
|
52
53
|
}
|
53
54
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
54
55
|
}, [baseUrl]);
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@arcblock/ux",
|
3
|
-
"version": "2.7.
|
3
|
+
"version": "2.7.20",
|
4
4
|
"description": "Common used react components for arcblock products",
|
5
5
|
"keywords": [
|
6
6
|
"react",
|
@@ -322,11 +322,11 @@
|
|
322
322
|
"peerDependencies": {
|
323
323
|
"react": ">=18.1.0"
|
324
324
|
},
|
325
|
-
"gitHead": "
|
325
|
+
"gitHead": "59c5b3d8110ed96d045b6ffdb70ab84910d37422",
|
326
326
|
"dependencies": {
|
327
327
|
"@arcblock/did-motif": "^1.1.13",
|
328
|
-
"@arcblock/icons": "^2.7.
|
329
|
-
"@arcblock/react-hooks": "^2.7.
|
328
|
+
"@arcblock/icons": "^2.7.20",
|
329
|
+
"@arcblock/react-hooks": "^2.7.20",
|
330
330
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
331
331
|
"@emotion/react": "^11.10.4",
|
332
332
|
"@emotion/styled": "^11.10.4",
|
@@ -17,7 +17,7 @@ function BlockletProvider({ children, baseUrl }) {
|
|
17
17
|
const [blockletData, setBlockletData] = useState(null);
|
18
18
|
const getBlockleData = useMemoizedFn(async () => {
|
19
19
|
if (!baseUrl || window.location.href.startsWith(baseUrl)) {
|
20
|
-
|
20
|
+
throw new Error('no blocklet data');
|
21
21
|
}
|
22
22
|
|
23
23
|
const url = new URL('__blocklet__.js', baseUrl);
|
@@ -32,7 +32,8 @@ function BlockletProvider({ children, baseUrl }) {
|
|
32
32
|
setBlockletData(data);
|
33
33
|
} catch {
|
34
34
|
// NOTICE: 如果获取指定 blockletData 失败,则使用 window.blocklet
|
35
|
-
|
35
|
+
const data = window.blocklet || window.env;
|
36
|
+
setBlockletData(data);
|
36
37
|
}
|
37
38
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
38
39
|
}, [baseUrl]);
|