You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
results in an unexpected compile error on use:mydirective=MyStruct {} when building an SSR app
Checking directives-ssr v0.1.0 (/home/lukas/dev/directives-ssr)
error[E0277]: expected a `Fn()` closure, found `MyStruct`
--> src/app.rs:28:5
|
28 | / view! {
29 | | <div
30 | | use:mydirective=MyStruct {}
| | ----------- this tail expression is of type `MyStruct`
31 | | >
32 | | "foo"
33 | | </div>
34 | | }
| |_____^ expected an `Fn()` closure, found `MyStruct`
|
= help: the trait `std::ops::Fn<()>` is not implemented for `MyStruct`
= note: wrap the `MyStruct` in a closure with no arguments: `|| { /* code */ }`
= help: the following other types implement trait `IntoAttribute`:
bool
char
isize
i8
i16
i32
i64
i128
and 26 others
= note: required for `MyStruct` to implement `IntoAttribute`
= note: this error originates in the macro `view` (in Nightly builds, run with -Z macro-backtrace for more info)
help: you might have meant to create the closure instead of a block
|
28 | |_| view! {
| +++
It seems that the view macro expects something IntoAttribute here, which it shouldn't.
Expected behavior
Expected that code to compile and execute the directive on the client (through the internal usage of create_effect).
Additional context
When the CSR feature is forced to be active using leptos = { version = "0.6.9", features = ["csr"] }, the app does compile.
And gracefully notifies about the incorrect selection of features...
Funny thing: This use of the directive wrapped in a custom component taking children always compiles, even without forcing the CSR feature...
Describe the bug
Using a custom directive, like in
results in an unexpected compile error on
use:mydirective=MyStruct {}
when building an SSR appIt seems that the view macro expects something
IntoAttribute
here, which it shouldn't.Leptos Dependencies
The test code lives here:
https://github.com/lpotthast/test-leptos-directives-ssr
To Reproduce
Steps to reproduce the behavior:
git clone https://github.com/lpotthast/test-leptos-directives-ssr.git
cd test-leptos-directives-ssr
cargo leptos watch
or just acargo check
Expected behavior
Expected that code to compile and execute the directive on the client (through the internal usage of
create_effect
).Additional context
When the CSR feature is forced to be active using
leptos = { version = "0.6.9", features = ["csr"] }
, the app does compile.And gracefully notifies about the incorrect selection of features...
Funny thing: This use of the directive wrapped in a custom component taking children always compiles, even without forcing the CSR feature...
The text was updated successfully, but these errors were encountered: