Skip to content

Conversation

@bwskin
Copy link
Contributor

@bwskin bwskin commented Oct 22, 2025

Replaces axum::extract::Query with a custom extractor based on serde_qs.
axum::extract::Query uses the serde_urlencoded crate, while on the client side, Dioxus currently relies on serde_qs.
This mismatch causes unexpected behavior and prevents proper deserialization of structs passed as arguments to #[get] server functions.

With this change, it becomes possible to use any type that serde_qs can serialize in a query string.

This PR is a followup to #4827
It’s a bit unstructured at the moment, as the module is temporarily placed in the fullstack-server crate.
Suggestions on a better location for it are highly welcome.

@bwskin bwskin requested a review from a team as a code owner October 22, 2025 09:43
@bwskin bwskin changed the title Introduce serde_qs extractor for query string Fullstack: Introduce serde_qs extractor for query string Oct 22, 2025
@bwskin bwskin force-pushed the feat/serverfn-struct-qs-extractor branch from e78d6f3 to f43680f Compare October 22, 2025 09:53
@bwskin bwskin force-pushed the feat/serverfn-struct-qs-extractor branch from f43680f to 91c3b00 Compare October 22, 2025 09:54
@bwskin
Copy link
Contributor Author

bwskin commented Oct 28, 2025

Moved module to fullstack-server/extract.rs

@jkelleyrtp
Copy link
Member

Thanks! I just added your changes to #4852 to test other changes in the query system. Should hope to have it merged later today. Since I moved the changes there, I'm going to close this PR.

Appreciate the contribution!

@jkelleyrtp jkelleyrtp closed this Oct 28, 2025
@bwskin
Copy link
Contributor Author

bwskin commented Nov 3, 2025

Thanks! I just added your changes to #4852 to test other changes in the query system. Should hope to have it merged later today. Since I moved the changes there, I'm going to close this PR.

Appreciate the contribution!

Hi, thanks for including this extractor! However, the issue I was trying to solve still exists in version 0.7.0 — the main query extractor is still the one from axum. I still can’t pass a struct as a query parameter unless I use a catch-all, which I believe will also fail with nested structs and blocks me from using additional parameters.

I managed to get it working correctly with the following patch:

diff --git a/packages/fullstack-macro/src/lib.rs b/packages/fullstack-macro/src/lib.rs
index 325ef7748..5ddd0530e 100644
--- a/packages/fullstack-macro/src/lib.rs
+++ b/packages/fullstack-macro/src/lib.rs
@@ -763,7 +763,7 @@ impl CompiledRoute {
         });
 
         out.push(parse_quote!(
-            dioxus_server::axum::extract::Query(#query_tokens)
+            dioxus_fullstack::payloads::Query(#query_tokens)
         ));
 
         out

Would you consider fixing this?

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