mirror of
https://github.com/leptos-rs/leptos
synced 2024-11-10 06:44:17 +00:00
docs/warning: fix <ActionForm/>
docs and add runtime warning for incorrect encodings (#1360)
This commit is contained in:
parent
8e68699435
commit
5af2f4e98d
1 changed files with 14 additions and 2 deletions
|
@ -342,8 +342,7 @@ fn current_window_origin() -> String {
|
|||
///
|
||||
/// ## Encoding
|
||||
/// **Note:** `<ActionForm/>` only works with server functions that use the
|
||||
/// default `Url` encoding or the `GetJSON` encoding, not with `CBOR` or other
|
||||
/// encoding schemes. This is to ensure that `<ActionForm/>` works correctly
|
||||
/// default `Url` encoding. This is to ensure that `<ActionForm/>` works correctly
|
||||
/// both before and after WASM has loaded.
|
||||
#[cfg_attr(
|
||||
any(debug_assertions, feature = "ssr"),
|
||||
|
@ -493,6 +492,19 @@ where
|
|||
});
|
||||
});
|
||||
let class = class.map(|bx| bx.into_attribute_boxed(cx));
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
{
|
||||
if I::encoding() != server_fn::Encoding::Url {
|
||||
leptos::warn!(
|
||||
"<ActionForm/> only supports the `Url` encoding for server \
|
||||
functions, but {} uses {:?}.",
|
||||
std::any::type_name::<I>(),
|
||||
I::encoding()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
let mut props = FormProps::builder()
|
||||
.action(action_url)
|
||||
.version(version)
|
||||
|
|
Loading…
Reference in a new issue