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

Resource of use_resource state should go back to Pending when a dependency changes. #2812

Open
rambip opened this issue Aug 9, 2024 · 1 comment · May be fixed by #3617
Open

Resource of use_resource state should go back to Pending when a dependency changes. #2812

rambip opened this issue Aug 9, 2024 · 1 comment · May be fixed by #3617
Labels
good first issue Good for newcomers hooks Changes to built-in hook package

Comments

@rambip
Copy link

rambip commented Aug 9, 2024

Problem

When using use_resource with reactive, dependencies, the state go from Pending to Ready, but when the future is restarted (when a dependency changes), the state remains Ready.

This should be pretty easy to fix, just change the implementation here:

let cb = use_callback(move |_| {

Note that the behaviour of SuspenseBoundary would change. It would display the fallback each time the future is restarted. But that would make more sense in my opinion.

A related issue would be to update the docs of use_future to clarify that it will not re-run when the dependencies changes, and that one should use use_resource instead.

Environment:

  • Dioxus version: master
@ealmloff ealmloff added the hooks Changes to built-in hook package label Aug 9, 2024
@ealmloff ealmloff added this to the 0.6.0 milestone Aug 9, 2024
@ealmloff ealmloff added the good first issue Good for newcomers label Oct 21, 2024
@bp7968h
Copy link

bp7968h commented Oct 26, 2024

Hi @rambip, @ealmloff, @ealmloff, can this be assigned to me please.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers hooks Changes to built-in hook package
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants