Skip to content

Commit

Permalink
fix: index out of range in CSR example
Browse files Browse the repository at this point in the history
  • Loading branch information
brofrain committed Mar 8, 2024
1 parent b75443d commit 6e40e0d
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
23 changes: 23 additions & 0 deletions examples/csr/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions examples/csr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ version = "0.0.0"
edition = "2021"

[dependencies]
console_error_panic_hook = "0.1.7"
console_log = "1"
getrandom = { version = "0.2.12", features = ["js"], optional = true }
leptos = { version = "0.6.9", features = ["csr", "nightly"] }
leptos_animated_for = { path = "../.." }
log = "0.4.20"
rand = "0.8.5"
4 changes: 3 additions & 1 deletion examples/csr/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ fn App() -> impl IntoView {
items.update(|items| {
let item = create_new_item(());
rng.update_value(|rng| {
items.insert(rng.gen_range(0..items.len()), item);
items.insert(rng.gen_range(0..=items.len()), item);
});
});
};
Expand Down Expand Up @@ -156,5 +156,7 @@ fn App() -> impl IntoView {
}

fn main() {
_ = console_log::init_with_level(log::Level::Debug);
console_error_panic_hook::set_once();
mount_to_body(App);
}

0 comments on commit 6e40e0d

Please sign in to comment.