Skip to content

Commit

Permalink
fix(list-render): update NODE_TO_INDEX and NODE_TO_PARENT when diffRe…
Browse files Browse the repository at this point in the history
…sult is undefined
  • Loading branch information
pubuzhixing8 committed Mar 18, 2024
1 parent 52fcaa1 commit edd539d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/tender-cobras-walk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"slate-angular": patch
---

update NODE_TO_INDEX and NODE_TO_PARENT when diffResult is undefined
4 changes: 3 additions & 1 deletion packages/src/view/render/list-render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ export class ListRender {
} else {
const newContexts = [];
this.children.forEach((child, index) => {
NODE_TO_INDEX.set(child, index);
NODE_TO_PARENT.set(child, parent);
let context = getContext(index, child, parentPath, childrenContext, this.viewContext);
const previousContext = this.contexts[index];
if (memoizedContext(this.viewContext, child, previousContext as any, context as any)) {
Expand Down Expand Up @@ -261,7 +263,7 @@ export function getCommonContext(
return { selection: null, decorations: ds };
}
} catch (error) {
this.options.viewContext.editor.onError({
viewContext.editor.onError({
code: SlateErrorCode.GetStartPointError,
nativeError: error
});
Expand Down

0 comments on commit edd539d

Please sign in to comment.