@superblocksteam/custom-components 0.0.23 → 1.0.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.
|
@@ -6,8 +6,9 @@ import { useHooksInternalContext } from "./hooksPlumbing";
|
|
|
6
6
|
export function useSuperblocksIsLoading() {
|
|
7
7
|
const { React, ccRenderingContext } = useHooksInternalContext();
|
|
8
8
|
const [isLoading, setIsLoading] = React.useState(ccRenderingContext.isLoadingRef.current);
|
|
9
|
-
|
|
10
|
-
React.
|
|
9
|
+
// we need to subscribe to changes immediately, so use `useLayoutEffect` to subscribe right after the render phase is finished
|
|
10
|
+
React.useLayoutEffect(() => {
|
|
11
|
+
ccRenderingContext.isLoadingSubscribers.add(setIsLoading);
|
|
11
12
|
return () => {
|
|
12
13
|
ccRenderingContext.isLoadingSubscribers.delete(setIsLoading);
|
|
13
14
|
};
|
|
@@ -6,8 +6,9 @@ import { useHooksInternalContext } from "./hooksPlumbing";
|
|
|
6
6
|
export function useSuperblocksWidgetSize() {
|
|
7
7
|
const { React, ccRenderingContext } = useHooksInternalContext();
|
|
8
8
|
const [widgetSize, setWidgetSize] = React.useState(ccRenderingContext.widgetSizeRef.current);
|
|
9
|
-
|
|
10
|
-
React.
|
|
9
|
+
// we need to subscribe to changes immediately, so use `useLayoutEffect` to subscribe right after the render phase is finished
|
|
10
|
+
React.useLayoutEffect(() => {
|
|
11
|
+
ccRenderingContext.widgetSizeSubscribers.add(setWidgetSize);
|
|
11
12
|
return () => {
|
|
12
13
|
ccRenderingContext.widgetSizeSubscribers.delete(setWidgetSize);
|
|
13
14
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superblocksteam/custom-components",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Official Superblocks SDK for developing custom components",
|
|
5
5
|
"homepage": "https://www.superblocks.com/",
|
|
6
6
|
"keywords": [
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"typescript": "^5.1.6"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@superblocksteam/util": "0.0
|
|
40
|
+
"@superblocksteam/util": "1.0.0",
|
|
41
41
|
"tslib": "^2.6.1"
|
|
42
42
|
}
|
|
43
43
|
}
|