Skip to content
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

fix: state reset issue on overlay reopen #58

Merged
merged 2 commits into from
Jul 14, 2024

Conversation

jungpaeng
Copy link
Member

Description

This change fixes an issue where overlays did not retain their state when reopened without unmounting, even though they were not removed from the DOM. The overlayReducer has been updated to maintain the state of overlays between close and open cycles, addressing an unintended state reset.

Related Issue: Fixes #57

Changes

  • Modified the overlayReducer to check if an overlay exists before updating its state in overlayData. If the overlay exists, its state is retained.
  • Ensured that overlays do not reset their state upon reopening unless explicitly re-initialized or unmounted.

Motivation and Context

This change is necessary to ensure that the overlay components behave as expected across user interactions.

How Has This Been Tested?

  • Tested by manually reopening overlays without unmounting them to ensure their state is maintained.

Screenshots (if appropriate):

2024-07-14.8.22.10.mov

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 modifies the overlayReducer to ensure that the overlayData does not get reset when an overlay is reopened without unmounting.
@jungpaeng jungpaeng self-assigned this Jul 14, 2024
Copy link

vercel bot commented Jul 14, 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 14, 2024 11:23am

Copy link

changeset-bot bot commented Jul 14, 2024

🦋 Changeset detected

Latest commit: 034cf93

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 merged commit b35ac6f into main Jul 14, 2024
2 checks passed
@jungpaeng jungpaeng deleted the fix/keep-overlay-data-without-unmount branch July 14, 2024 11:24
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.

[Bug] Unexpected Component Reset on Reopening Overlays without Unmounting
1 participant