Skip to content

Conversation

@yydcnjjw
Copy link
Contributor

No description provided.

@yydcnjjw yydcnjjw requested a review from a team as a code owner July 25, 2025 13:16
@yydcnjjw yydcnjjw changed the title feat: Use Rc for lifecycle management fix: Use Rc for lifecycle management Jul 25, 2025
@ealmloff
Copy link
Member

ealmloff commented Aug 6, 2025

This fixes #4512. The implementation of Clone and Drop for LifeCycle in use_drop were poorly behaved such that lifecycle is not equal to lifecycle.clone(). We used to return a cloned version of the value and keep the original version to drop later. That changed in #4381 to return the original version of the value passed into use_hook and store a cloned version. Changing to Rc fixes the behavior so we don't rely on which value is stored and which one is returned

Copy link
Member

@ealmloff ealmloff left a comment

Choose a reason for hiding this comment

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

Thanks! I added some tests so we can avoid regressions here in the future

@ealmloff ealmloff merged commit a610aae into DioxusLabs:main Aug 6, 2025
21 checks passed
@yydcnjjw yydcnjjw deleted the fix-use-drop branch August 20, 2025 09:01
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.

2 participants