Skip to content

Commit

Permalink
Unsetting of _forceRefresh
Browse files Browse the repository at this point in the history
  • Loading branch information
bmingles committed Sep 8, 2020
1 parent 7b9d9a5 commit 931b864
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/plugins/spellcheckPlugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,14 @@ export function withSpellcheck<TEditor extends Editor>(
}

for (const [, path] of entries) {
Transforms.setNodes(
editor,
// Setting an arbitrary prop on the node to a new object will cause
// it to re-render. Transform check for === equality on each prop,
// so it has to be a new object for the operation to be applied.
{ _forceRefresh: {} },
{
at: path,
}
)
// Setting an arbitrary prop on the node to a new object will cause
// it to re-render. Transform check for === equality on each prop,
// so it has to be a new object for the operation to be applied.
// Setting to a new object then undefined to avoid having to strip
// the property later on.
for (const _forceRefresh of [{}, undefined]) {
Transforms.setNodes(editor, { _forceRefresh }, { at: path })
}
}
}, 500)
}
Expand Down

0 comments on commit 931b864

Please sign in to comment.