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: Update 'current' to Reflect Last Overlay When Closing Intermediate Overlays #50

Merged
merged 2 commits into from
Jul 13, 2024

Conversation

jungpaeng
Copy link
Member

@jungpaeng jungpaeng commented Jul 13, 2024

Description

This PR addresses an issue where the 'current' overlay does not update to the last overlay when an intermediate overlay is closed. This behavior can lead to inconsistencies in the UI state.

Changes

  • Modified the reducer logic to ensure 'current' is correctly set to the last overlay when closing an intermediate overlay.
  • Added checks to handle cases where the overlay order is modified.

Motivation and Context

The previous implementation did not account for scenarios where closing an intermediate overlay should update the 'current' overlay to reflect the last one in the order. This fix ensures that the 'current' overlay always points to the last opened overlay, maintaining consistent UI behavior.

How Will This Be Tested?

  • Tested by manually opening and closing multiple overlays in various orders to ensure 'current' updates correctly.
  • I plan to add unit tests to verify the reducer logic for maintaining the correct 'current' overlay.

Related Issues

Fixes #44

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)

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

…iate overlays

- Resolve issue where 'current' does not update to the last overlay when closing an intermediate overlay
- Add logic to correctly update 'current' in reducer
@jungpaeng jungpaeng self-assigned this Jul 13, 2024
Copy link

vercel bot commented Jul 13, 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 13, 2024 5:34pm

Copy link

changeset-bot bot commented Jul 13, 2024

🦋 Changeset detected

Latest commit: 66441ee

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 5d7e84d into main Jul 13, 2024
2 checks passed
@jungpaeng jungpaeng deleted the fix/update-current-on-close branch July 13, 2024 17:36
@github-actions github-actions bot mentioned this pull request Jul 13, 2024
* @example open - [1, 2, 3, 4]
* close 2 => current: 4
* close 4 => current: 3
* close 2 => current: 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I think close 3 => current: 1 is correct.
I'll write a PR.

@jgjgill
Copy link
Contributor

jgjgill commented Jul 14, 2024

Oh, thanks for the thorough check. 😂

@jgjgill jgjgill mentioned this pull request Jul 14, 2024
11 tasks
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.

Is the intended behavior that firing a close event does not change current?
2 participants