Skip to content

Commit

Permalink
make unmountComponent idempotent
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Kim authored and brainkim committed Nov 7, 2023
1 parent 53be4cf commit 4957f70
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/crank.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2674,7 +2674,12 @@ function resumePropsIterator(ctx: ContextImpl): void {

// TODO: async unmounting
function unmountComponent(ctx: ContextImpl): void {
if (ctx.f & IsUnmounted) {
return;
}

clearEventListeners(ctx);

const callbacks = cleanupMap.get(ctx);
if (callbacks) {
cleanupMap.delete(ctx);
Expand Down

0 comments on commit 4957f70

Please sign in to comment.