Skip to content
This repository has been archived by the owner on Dec 31, 2020. It is now read-only.

Commit

Permalink
Iteration
Browse files Browse the repository at this point in the history
  • Loading branch information
Bnaya committed Nov 5, 2020
1 parent 0ce1306 commit c3b34de
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/useObserver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function observerComponentNameFor(baseComponentName: string) {
}

/**
* We use class to make it easier to detect in heap explorer
* We use class to make it easier to detect in heap snapshots by name
*/
class ObjectToBeRetainedByReact {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,16 @@ export function createReactionCleanupTrackingUsingFinalizationRegister(
reactionTrackingRef.current = createTrackingData(reaction)
reactionTrackingRef.current.finalizationRegistryCleanupToken = token
cleanupTokenToReactionTrackingMap.set(token, reactionTrackingRef.current)

return reactionTrackingRef.current
},
recordReactionAsCommitted(reactionRef: React.MutableRefObject<IReactionTracking | null>) {
registry.unregister(reactionRef)

for (const [key, value] of cleanupTokenToReactionTrackingMap.entries()) {
if (value === reactionRef.current) {
cleanupTokenToReactionTrackingMap.delete(key)
}
if (reactionRef.current && reactionRef.current.finalizationRegistryCleanupToken) {
cleanupTokenToReactionTrackingMap.delete(
reactionRef.current.finalizationRegistryCleanupToken
)
}
},
forceCleanupTimerToRunNowForTests() {
Expand Down

0 comments on commit c3b34de

Please sign in to comment.