Skip to content

Commit 51696b7

Browse files
committed
fix storing compositions
1 parent 5e504a6 commit 51696b7

File tree

2 files changed

+30
-20
lines changed

2 files changed

+30
-20
lines changed

libs/app-canvas/src/app/storage/indexeddb-storage-provider.ts

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,27 +17,33 @@ function storeTransaction(
1717
ready: () => void,
1818
failed: () => void
1919
) {
20-
const objectRequest = store.put(
21-
{
22-
flow: transaction?.flow,
23-
flowId: transaction?.flowId,
24-
name: transaction?.name,
25-
},
26-
transaction?.flowId
27-
);
20+
try {
21+
const objectRequest = store.put(
22+
{
23+
flow: transaction?.flow,
24+
flowId: transaction?.flowId,
25+
name: transaction?.name,
26+
},
27+
transaction?.flowId
28+
);
2829

29-
objectRequest.onerror = function (event) {
30-
console.log('handleTransactions error', event);
31-
};
30+
objectRequest.onerror = function (event) {
31+
console.log('handleTransactions error', event);
32+
};
3233

33-
objectRequest.onsuccess = function (event) {
34-
if (objectRequest.result) {
35-
isProcessing = false;
36-
handleTransactions(ready, failed);
37-
} else {
38-
console.log('handleTransactions error in onsuccess', event);
39-
}
40-
};
34+
objectRequest.onsuccess = function (event) {
35+
if (objectRequest.result) {
36+
isProcessing = false;
37+
handleTransactions(ready, failed);
38+
} else {
39+
console.error('handleTransactions error in onsuccess', event);
40+
}
41+
};
42+
} catch (error) {
43+
console.error('storeTransaction error', error);
44+
console.error('storeTransaction failed', transaction?.flow);
45+
failed();
46+
}
4147
}
4248

4349
function handleTransactions(ready: () => void, failed: () => void) {

libs/app-canvas/src/app/storage/serialize-canvas.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,10 @@ export const serializeCompositions = <T>(
265265
id: composition.id,
266266
name: composition.name,
267267
nodes: composition.nodes.map((node) => {
268-
return node;
268+
return {
269+
...node,
270+
nodeInfo: cleanupNodeInfoForSerializing(node.nodeInfo as NodeInfo),
271+
};
269272
// if (node.nodeType === NodeType.Connection) {
270273
// const connection =
271274
// node as unknown as IConnectionNodeComponent<NodeInfo>;
@@ -299,6 +302,7 @@ export const serializeCompositions = <T>(
299302
// nodeInfo: cleanupNodeInfoForSerializing(node.nodeInfo as NodeInfo),
300303
// };
301304
}),
305+
302306
thumbs: composition.thumbs,
303307
inputNodes:
304308
composition.inputNodes?.map((node) => {

0 commit comments

Comments
 (0)