@cntrl-site/sdk-nextjs 1.0.19-alpha.1 → 1.0.19-alpha.2

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.
@@ -8,8 +8,8 @@ function useStatesTransitions(el, state, values) {
8
8
  const { interactionsStatesMap } = (0, react_1.useContext)(InteractionsContext_1.InteractionsContext);
9
9
  const { layoutId } = (0, useCurrentLayout_1.useCurrentLayout)();
10
10
  const activeStates = Object.values(interactionsStatesMap);
11
- const statesForLayout = (0, react_1.useMemo)(() => layoutId ? state[layoutId] : {}, [layoutId]);
12
- const itemStatesIds = Object.keys(statesForLayout);
11
+ const statesForLayout = (0, react_1.useMemo)(() => layoutId ? state[layoutId] : {}, [state, layoutId]);
12
+ const itemStatesIds = statesForLayout ? Object.keys(statesForLayout) : [];
13
13
  const itemActiveStateId = activeStates.find((stateId) => itemStatesIds.includes(stateId));
14
14
  (0, react_1.useEffect)(() => {
15
15
  if (!itemActiveStateId || !el)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cntrl-site/sdk-nextjs",
3
- "version": "1.0.19-alpha.1",
3
+ "version": "1.0.19-alpha.2",
4
4
  "description": "SDK for Next.js",
5
5
  "main": "lib/index.js",
6
6
  "types": "src/index.ts",
@@ -14,8 +14,8 @@ export function useStatesTransitions(
14
14
  const { interactionsStatesMap } = useContext(InteractionsContext);
15
15
  const { layoutId } = useCurrentLayout();
16
16
  const activeStates = Object.values(interactionsStatesMap);
17
- const statesForLayout = useMemo(() => layoutId ? state[layoutId] : {}, [layoutId]);
18
- const itemStatesIds = Object.keys(statesForLayout);
17
+ const statesForLayout = useMemo(() => layoutId ? state[layoutId] : {}, [state, layoutId]);
18
+ const itemStatesIds = statesForLayout ? Object.keys(statesForLayout) : [];
19
19
  const itemActiveStateId = activeStates.find((stateId) => itemStatesIds.includes(stateId));
20
20
  useEffect(() => {
21
21
  if (!itemActiveStateId || !el) return;