Skip to content

Commit

Permalink
Add a Math.random() to ensure the callback is called exactly once
Browse files Browse the repository at this point in the history
  • Loading branch information
tmeasday committed Jul 28, 2022
1 parent 049d84c commit b2b7a15
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion code/renderers/react/src/render.tsx
Expand Up @@ -55,7 +55,11 @@ const renderElement = async (node: ReactElement, el: Element) => {

return new Promise((resolve) => {
if (root) {
root.render(<WithCallback callback={() => resolve(null)}>{node}</WithCallback>);
root.render(
<WithCallback key={Math.random()} callback={() => resolve(null)}>
{node}
</WithCallback>
);
} else {
ReactDOM.render(node, el, () => resolve(null));
}
Expand Down

0 comments on commit b2b7a15

Please sign in to comment.