Skip to content

Fix unmount bug#523

Merged
marcospassos merged 2 commits intomasterfrom
fix-unmounting
Mar 16, 2025
Merged

Fix unmount bug#523
marcospassos merged 2 commits intomasterfrom
fix-unmounting

Conversation

@marcospassos
Copy link
Member

Summary

Currently, when using Strict Mode – which causes the component to mount, unmount, and remount during the initial render – the component never updates with the loaded content because the mounted flag is permanently set to false after the first unmount. This PR fixes the issue by resetting the mounted flag to true at the start of each useEffect call, and providing a cleanup callback to set it back to false when the component unmounts.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, 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
  • I have checked my code and corrected any misspellings

@marcospassos marcospassos added the bug Something isn't working label Mar 16, 2025
@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 16, 2025

Open in Stackblitz

npm i https://pkg.pr.new/@croct/plug-react@523

commit: 0b2bc16

@marcospassos marcospassos merged commit be40fda into master Mar 16, 2025
19 checks passed
@marcospassos marcospassos deleted the fix-unmounting branch March 16, 2025 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant