Skip to content

Commit 4cbb942

Browse files
committed
more bug fixes
1 parent 9d3f506 commit 4cbb942

2 files changed

Lines changed: 17 additions & 2 deletions

File tree

src/addons/addons/collaboration/helpers/helper.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,11 @@ export function deserializeBlockFromYjs(yBlockMap) {
9595
let current = block;
9696
for (let i = 0; i < pathParts.length - 1; i++) {
9797
const part = pathParts[i];
98-
if (!current[part]) current[part] = {};
98+
if (!current[part]) {
99+
current[part] = (pathParts[0] === 'inputs' && i === 1)
100+
? { name: part, block: null, shadow: null }
101+
: {};
102+
}
99103
current = current[part];
100104
}
101105
current[pathParts[pathParts.length - 1]] = value;

src/addons/addons/collaboration/helpers/observeHandlers.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,11 @@ export function sharedBlocks(event){
8686
let current = block;
8787
for (let i = 0; i < pathParts.length - 1; i++) {
8888
const part = pathParts[i];
89-
if (!current[part]) current[part] = {};
89+
if (!current[part]) {
90+
current[part] = (pathParts[0] === 'inputs' && i === 1)
91+
? { name: part, block: null, shadow: null }
92+
: {};
93+
}
9094
current = current[part];
9195
}
9296
current[pathParts[pathParts.length - 1]] = val;
@@ -331,6 +335,13 @@ export function sharedComments (event){
331335
Object.assign(target.comments[commentId], commentData);
332336
}
333337
} else if (change.action === 'delete') {
338+
const deletedComment = target.comments[commentId];
339+
if (deletedComment && deletedComment.blockId) {
340+
const owningBlock = target.blocks.getBlock(deletedComment.blockId);
341+
if (owningBlock && owningBlock.comment === commentId) {
342+
delete owningBlock.comment;
343+
}
344+
}
334345
delete target.comments[commentId];
335346
}
336347
});

0 commit comments

Comments
 (0)