Fix use_query and use_prepared_query stalling issue#105
Open
Madoshakalaka wants to merge 10 commits intobounce-rs:masterfrom
Open
Fix use_query and use_prepared_query stalling issue#105Madoshakalaka wants to merge 10 commits intobounce-rs:masterfrom
Madoshakalaka wants to merge 10 commits intobounce-rs:masterfrom
Conversation
futursolo
reviewed
Mar 28, 2026
| let run_query = run_query.clone(); | ||
|
|
||
| if value_state.value.is_none() { | ||
| run_query(RunQueryInput { |
Member
There was a problem hiding this comment.
Unfortunately, I still don’t think this is the correct solution.
This piece of code is running side effects without a use_effect clause.
This is meant to be run exactly once.
Function components should not modify states at the rendering stage where it has no control over when or how many times the renderer will trigger this piece of code.
Contributor
Author
There was a problem hiding this comment.
how about now, I restructured both use_query and use_prepared_query to follow Yew's
use_future_with pattern. And added some e2e tests to assert the number of fetches.
# Conflicts: # .github/workflows/everything.yml # CHANGELOG.md
Restructures use_query and use_prepared_query to follow Yew's use_future_with pattern: query initiation is now integral to producing the Suspension value via Suspension::from_future, rather than being a bare side effect in the render body. Adds browser-based e2e tests using fantoccini/geckodriver that verify: - use_query and use_prepared_query do not stall on input change - query results are cached for seen inputs - no duplicate requests are made
The e2e crate depends on tokio/mio which cannot compile for wasm32. Excluding it from the workspace prevents cargo make tests from trying to build it for the wasm target.
# Conflicts: # examples/queries-ssr/src/lib.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
#104 was an ugly fix with an extra yew_hooks dependency, I think this PR fixes #102 and #99 properly.
I have tested bounce before and after the fix on two minimal repos:
https://github.com/Madoshakalaka/use-query-stalls
and
https://github.com/Madoshakalaka/use-prepared-query-stall
(a SSR setup with axum)
I made sure
Checklist
CHANGELOG.md.