-
-
Notifications
You must be signed in to change notification settings - Fork 932
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
Fix/server macro defaults #3403
base: main
Are you sure you want to change the base?
Conversation
Thanks for working on this! It looks like some unrelated changes to base path leaked into this PR. The two main fields that need documentation are the input and output fields. Since they effect both the encoding and the trait bounds on the inputs and outputs, it would be useful to include examples with the full server function, instead of just the encoding type. Here are a few examples of the bounds they imply: /// Setting the type to `StreamingJson` means you need to return something that implements From<JsonStream<T>>
/// where T implements serde::serialize and serde::de::DeserializeOwned
#[server(output = StreamingJson)]
pub async fn json_stream_fn() -> Result<JsonStream<String>, ServerFnError> {
todo!()
}
/// Setting the type to `StreamingText` means you need to return something that implements From<TextStream>
#[server(output = StreamingText)]
pub async fn text_stream_fn() -> Result<TextStream, ServerFnError> {
todo!()
}
/// Setting the type to `PostUrl` means you need to return something that implements Serialize and Deserialize.
/// This uses `serde_qs` which imposes the following requirements:
/// - Be less than 5 levels deep
/// - Contain no `serde(flatten)` attributes
#[server(output = PostUrl)]
pub async fn form_fn() -> Result<TextStream, ServerFnError> {
todo!()
} |
I have added the examples as requested @ealmloff 😄 |
} | ||
|
||
pub(crate) fn asset_dir_default() -> PathBuf { | ||
PathBuf::from("assets") | ||
} | ||
|
||
pub(crate) fn out_dir_default() -> PathBuf { | ||
PathBuf::from("dist") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may break the deployment script due to changing default build artifact directory. How about returning PathBuf for target/dx
, which is current out directory described in dioxus_crate.rs:100
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hackartists Hello!
I think this is the PR you're referring to #3393
And I already made that change there
Enhanced the #[server] macro documentation for improved clarity and usability. Key updates: