The problem is that leptos-fluent macros tr! and move_tr! are based on a bug in Leptos v0.6 that has been solved on v0.7 (see https://github.com/leptos-rs/leptos/issues/2852), providing a false sense of security.
Currently we call expect_context inside tr! and move_tr!, but if these invocations are not located inside the reactive ownership tree, the call would panic. An example is provided in the previous example, calling them at on:click event.
The solution is to allow to pass an optional first i18n expr parameter to tr! and move_tr! to make a copy of the context and document this situation. Note that leptos_i18n doesn't have this problem because is always forcing the user to pass i18n context to t! macros.
The problem is that leptos-fluent macros
tr!
andmove_tr!
are based on a bug in Leptos v0.6 that has been solved on v0.7 (see https://github.com/leptos-rs/leptos/issues/2852), providing a false sense of security.Currently we call
expect_context
insidetr!
andmove_tr!
, but if these invocations are not located inside the reactive ownership tree, the call would panic. An example is provided in the previous example, calling them aton:click
event.The solution is to allow to pass an optional first
i18n
expr parameter totr!
andmove_tr!
to make a copy of the context and document this situation. Note that leptos_i18n doesn't have this problem because is always forcing the user to passi18n
context tot!
macros.