DioxusLabs / dioxus

Fullstack app framework for web, desktop, mobile, and more.
https://dioxuslabs.com
Apache License 2.0
21.64k stars 833 forks source link

Enhance the ergonomics and security of ServerFnError #3243

Open ryo33 opened 6 days ago

ryo33 commented 6 days ago

Problems

Feature Request

Allow users to specify any error type for the server fn result where E: Serialize + DeserializeOwned + From<ServerFnError> + Debug + Display + Error. This could also require AsRef<ServerFnError> if Dioxus internally needs to identify the error kind on the client side. Since the ServerFnError itself satisfies these bounds, this change would be backward-compatible with the existing signature. However, I'd like to remove the ServerFnError::WrappedServerError and the corresponding generics field from it.

This feature would give users full control over From, Serialize, and Deserialize implementations for their error types and addresses the issues outlined above.

Implement Suggestion

Fork the server_fn_macro into the packages/server_macro and customize it as necessary.

Questions