Comments (6)
Here’s a toy example to reproduce it: https://github.com/VincentBerthier/leptos-repro/tree/i18n
from leptos.
I've tried to look at the code generated by #[island]
and could not found the culprit, so it might but a problem with some wasm_bindgen
macros that assume it to exist at the root, not sure.
from leptos.
if I change those lines: https://github.com/leptos-rs/leptos/blob/0658a550b09d70c372e1a24957f8b0ff90b0f033/leptos_macro/src/component.rs#L449C13-L464C14
to this:
let mod_name = format_ident!("hydrate_fn_{}", hydrate_fn_name);
quote! {
#[allow(non_snake_case)]
mod #mod_name {
use super::*;
use ::leptos::wasm_bindgen; // <-- import wasm_bindgen here
#[::leptos::wasm_bindgen::prelude::wasm_bindgen]
#[allow(non_snake_case)]
pub fn #hydrate_fn_name(el: ::leptos::web_sys::HtmlElement) {
if let Some(Ok(key)) = el.dataset().get(::leptos::wasm_bindgen::intern("hkc")).map(|key| std::str::FromStr::from_str(&key)) {
::leptos::leptos_dom::HydrationCtx::continue_from(key);
}
#deserialize_island_props
_ = ::leptos::run_as_child(move || {
::leptos::SharedContext::register_island(&el);
::leptos::leptos_dom::mount_to_with_stop_hydrating(el, false, move || {
#name(#island_props)
})
});
}
}
pub use #mod_name::#hydrate_fn_name;
}
The error goes away, but this outputed code never direcly use as root wasm_bindgen
, so the problem must comes from the wasm_bindgen::prelude::wasm_bindgen
macro...
from leptos.
Digging through wasm-bindgen
source code and docs I discovered that you can add a wasm_bindgen =
feature to the wasm_bindgen
macro:
#[wasm_bindgen(wasm_bindgen = ::leptos::wasm_bindgen)]
Anyone want to test this out against the islands implementation to see if it fixes the above issue and make a quick PR?
from leptos.
Yeah sure! I have everything needed to test that locally, I will try it when I get back home from work
from leptos.
It did fix it! I'm making a PR for the fix
from leptos.
Related Issues (20)
- Double fetch when starting at `ParamSegment` at some route belonging to `ParentRoute`, navigate to parent and back down
- beta5 problems
- [0.7] Storing a new item in the arena while holding a shared reference to an arena-allocated item fails HOT 2
- [0.7] Large HTML trees can cause stack overflows in debug mode with no useful error message HOT 4
- [0.7] LocalResources loaded in islands do not trigger Suspense in non-island parents HOT 2
- `Signal<T, S = SyncStorage>` doesn't implement `Track` HOT 5
- [0.7-beta5] Islands hydration issue (unique ID problem) HOT 3
- Double navigation cause desync beetween `Location::pathname` and the actual URL HOT 1
- [0.7] initial state of signal not read for dynamic classes HOT 2
- [0.7] Resource lacks `Debug`
- Compilation failed due to server_fn, no method found HOT 2
- Issues with runtime crashes when using ProtectedParentRoute HOT 5
- [0.7] panick when loading a blocking resource
- Nested routes in separate component don't compile when already inside ParentRoute. HOT 1
- Changes added in commit #5af7b54c seems to be causing issues with rendering svg icons
- Upgrade Lepros rkyv integration to support rkyv 8 HOT 1
- template macro page shows view macro page content HOT 1
- [0.7] runtime error: stored children already disposed HOT 1
- `expect_context` in server fn backing a resource panics when the resource is in a context HOT 2
- [0.7] `expect_context` not seeing the context within a router and a `<Show fallback>`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from leptos.