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

Use a gen in PartialEq for UseSharedState #1389

Merged
merged 5 commits into from
Sep 13, 2023

Conversation

DanielAlbl
Copy link
Contributor

So I had tried using a UseSharedState as a dependency for use_future, and it wasn't re-running when it changed. I think this was because it was comparing the .inner values which still were pointing to the same data.
I implemented a special UseFutureDep so it would compare a gen value, sort of following the example of UseRef. I did have to remove the PartialEq here to avoid conflicting with this: impl<A: Dep> UseFutureDep for &A, but this might not be the right thing to do.

packages/hooks/src/use_shared_state.rs Outdated Show resolved Hide resolved
@ealmloff ealmloff added enhancement New feature or request hooks Changes to built-in hook package labels Aug 22, 2023
@DanielAlbl DanielAlbl changed the title Special case UseFutureDep for UseSharedState Use a gen in PartialEq for UseSharedState Aug 30, 2023
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.

Sorry I lost track of this. Looks good, thank you!

@ealmloff ealmloff added the breaking This is a breaking change label Sep 2, 2023
@ealmloff
Copy link
Member

ealmloff commented Sep 2, 2023

Clippy failure is unrelated. This change can potentially be breaking (this could fail to memorize some props). Waiting for a second review before merging

@ealmloff ealmloff merged commit 18dca07 into DioxusLabs:master Sep 13, 2023
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking This is a breaking change enhancement New feature or request hooks Changes to built-in hook package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants