Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Fix AvatarHeadDecapComponent reactor cleanup #7753

Merged
merged 1 commit into from
Mar 15, 2023

Conversation

speigg
Copy link
Member

@speigg speigg commented Mar 14, 2023

Essentially, this is an anti-pattern:

useEffect(() => {
  if (condition) {
    // do something
  } else {
    // cleanup
  }
})

Because the cleanup code does not necessarily run when the reactor is stopped. The correct pattern is:

useEffect(() => {
  if (condition) {
    // do something
    return () => { 
      // cleanup 
    }
  }
})

Also updates hasComponent to be based on Component.existenceMap as source of truth

References

closes #insert number here

Checklist

  • If this PR is still a WIP, convert to a draft
  • When this PR is ready, mark it as "Ready for review"
  • ensure all checks pass
  • Changes have been manually QA'd
  • Changes reviewed by at least 2 approved reviewer

QA Steps

List any additional steps required to QA the changes of this PR, as well as any supplemental images or videos.

Also updates hasComponent to be based on Component.existenceMap as source of truth
@speigg speigg requested a review from HexaField March 14, 2023 23:51
@HexaField HexaField added this pull request to the merge queue Mar 15, 2023
Merged via the queue into dev with commit 38f6b2c Mar 15, 2023
@HexaField HexaField deleted the fix-avatarheaddecap-reactor branch March 15, 2023 00:04
@HexaField HexaField restored the fix-avatarheaddecap-reactor branch March 15, 2023 00:06
@HexaField HexaField deleted the fix-avatarheaddecap-reactor branch March 15, 2023 00:07
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants