8000 feat: Add cleanup effect for unmounting by jungpaeng · Pull Request #64 · toss/overlay-kit · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: Add cleanup effect for unmounting #64

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 17, 2024

Conversation

jungpaeng
Copy link
Member

This commit adds a useEffect cleanup function to the OverlayProvider component that dispatches a ‘REMOVE_ALL’ action upon unmounting. This ensures that overlays are properly cleaned up during testing scenarios, preventing state leakage and side effects from persistent overlays.

Description

This commit introduces a useEffect cleanup function in the OverlayProvider component that dispatches a 'REMOVE_ALL' action when the component unmounts.
This change ensures that all overlays are properly cleaned up during testing scenarios, preventing state leakage and side effects from persistent overlays.

Related Issue: Fixes #63

Changes

  • Added a useEffect cleanup function in OverlayProvider to dispatch 'REMOVE_ALL' on unmount.

Motivation and Context

This change is necessary to enhance the testability of the OverlayProvider by ensuring overlays do not persist state across tests, which can lead to unpredictable behavior and flaky tests.

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have performed a self-review of my own code.
  • My code is commented, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • Any dependent changes have been merged and published in downstream modules.

Further Comments

This commit adds a useEffect cleanup function to the OverlayProvider component that dispatches a ‘REMOVE_ALL’ action upon unmounting.
This ensures that overlays are properly cleaned up during testing scenarios, preventing state leakage and side effects from persistent overlays.
@jungpaeng jungpaeng self-assigned this Jul 17, 2024
Copy link
8000 vercel bot commented Jul 17, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
overlay-kit ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 17, 2024 4:39pm

Copy link
changeset-bot bot commented Jul 17, 2024

🦋 Changeset detected

Latest commit: 6ba184e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
overlay-kit Patch
@overlay-kit/framer-motion Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@jungpaeng jungpaeng marked this pull request as ready for review July 17, 2024 16:39
@jungpaeng jungpaeng merged commit 01eaa3c into main Jul 17, 2024
2 checks passed
@jungpaeng jungpaeng deleted the feat/overlay-provider-unmount-cleanup branch July 17, 2024 17:05
This was 6E5B referenced Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Question: Intent on how overlay-kit Provider works
1 participant
0