Skip to content

Commit

Permalink
Merge pull request #170 from sabify/doc-asyncc
Browse files Browse the repository at this point in the history
fix(docs): t_string_async macro example correct implementation
  • Loading branch information
Baptistemontan authored Dec 17, 2024
2 parents 3be9091 + 9d5a005 commit e6ea93b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/book/src/reduce_size/02_dynamic_load.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ Feel free to make yourself a macro to wrap them:

```rust
macro_rules! t_string_async {
(($tt:tt)*) => {
AsyncDerived::new(move || t_string!(($tt)*))
($($tt:tt),*) => {
leptos::prelude::AsyncDerived::new(move || leptos_i18n::t_string!($($tt),*))
}
}
```

This could have been the design by default, but there is multiple ways to handle it so I decided to leave the choice to the user.

_note_: They are technically not needed to be async on the server, as translations are still baked in for them,
but for the API to be the same on the client and the server they return the value wrapped in an async bloc.
but for the API to be the same on the client and the server they return the value wrapped in an async block.

### Server Fn

Expand Down

0 comments on commit e6ea93b

Please sign in to comment.