Skip to content

Commit 9ff4239

Browse files
committed
fix the edge case that cut in A, paste in B, undo in a and only done at the second time
1 parent c49c9bf commit 9ff4239

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

app/src/protyle/undo/index.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,15 @@ export class Undo {
8282
if (ids.size === 0) {
8383
return;
8484
}
85-
const existResponse = await fetchSyncPost("/api/block/checkBlocksExist", {ids: Array.from(ids)});
85+
let existResponse: IWebSocketData;
86+
try {
87+
existResponse = await fetchSyncPost("/api/block/checkBlocksExist", {ids: Array.from(ids)});
88+
} catch (e) {
89+
return;
90+
}
91+
if (!existResponse?.data) {
92+
return;
93+
}
8694
const replacements: [string, string][] = [];
8795
ids.forEach(id => {
8896
if (existResponse.data[id] === true) {

0 commit comments

Comments
 (0)