@chaibuilder/sdk 2.0.0-beta.84 → 2.0.0-beta.90
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/core.cjs +15 -9
- package/dist/core.js +15 -9
- package/package.json +1 -1
package/dist/core.cjs
CHANGED
|
@@ -1249,16 +1249,22 @@ const useRemoveBlocks = () => {
|
|
|
1249
1249
|
);
|
|
1250
1250
|
};
|
|
1251
1251
|
const useUpdateBlockAtom = () => {
|
|
1252
|
+
const [blocks] = useBlocksStore();
|
|
1253
|
+
console.log("Default Blocks: ", blocks);
|
|
1252
1254
|
return useAtomCallback(
|
|
1253
|
-
React.useCallback(
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1255
|
+
React.useCallback(
|
|
1256
|
+
(get, set, { id, props }) => {
|
|
1257
|
+
const blockAsAtoms = get(pageBlocksAtom);
|
|
1258
|
+
console.log("From Atom callback", blocks);
|
|
1259
|
+
const blockAtom = lodashEs.find(blockAsAtoms, (b) => b._id === id);
|
|
1260
|
+
if (!blockAtom) {
|
|
1261
|
+
console.warn(`Block with id ${id} not found`);
|
|
1262
|
+
return;
|
|
1263
|
+
}
|
|
1264
|
+
return set(blockAtom._atom, { ...get(blockAtom._atom), ...props });
|
|
1265
|
+
},
|
|
1266
|
+
[pageBlocksAtom]
|
|
1267
|
+
)
|
|
1262
1268
|
);
|
|
1263
1269
|
};
|
|
1264
1270
|
const useGetBlockAtomValue = () => {
|
package/dist/core.js
CHANGED
|
@@ -1234,16 +1234,22 @@ const useRemoveBlocks = () => {
|
|
|
1234
1234
|
);
|
|
1235
1235
|
};
|
|
1236
1236
|
const useUpdateBlockAtom = () => {
|
|
1237
|
+
const [blocks] = useBlocksStore();
|
|
1238
|
+
console.log("Default Blocks: ", blocks);
|
|
1237
1239
|
return useAtomCallback(
|
|
1238
|
-
useCallback(
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1240
|
+
useCallback(
|
|
1241
|
+
(get2, set2, { id, props }) => {
|
|
1242
|
+
const blockAsAtoms = get2(pageBlocksAtom);
|
|
1243
|
+
console.log("From Atom callback", blocks);
|
|
1244
|
+
const blockAtom = find(blockAsAtoms, (b) => b._id === id);
|
|
1245
|
+
if (!blockAtom) {
|
|
1246
|
+
console.warn(`Block with id ${id} not found`);
|
|
1247
|
+
return;
|
|
1248
|
+
}
|
|
1249
|
+
return set2(blockAtom._atom, { ...get2(blockAtom._atom), ...props });
|
|
1250
|
+
},
|
|
1251
|
+
[pageBlocksAtom]
|
|
1252
|
+
)
|
|
1247
1253
|
);
|
|
1248
1254
|
};
|
|
1249
1255
|
const useGetBlockAtomValue = () => {
|