diff --git a/.gitignore b/.gitignore index 36f5292..f775191 100644 --- a/.gitignore +++ b/.gitignore @@ -23,10 +23,11 @@ app/static/**/*.css *.swo .DS_Store -# Environment variables +# Environment variables and local files .env .env.local .env.*.local +**/*.local # Debug logs debug/ diff --git a/Cargo.toml b/Cargo.toml index ba85cf8..974525c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,7 +20,7 @@ members = [ [workspace.package] # Current release version. -version = "0.2.0" +version = "0.2.1" # Rust edition for language and compiler features. edition = "2024" @@ -47,8 +47,8 @@ rust-version = "1.85" # Both `path` (for local development) and `version` (for crates.io resolution) # are specified so that `cargo publish` resolves the dependency from the registry # while local builds use the workspace path. -yew-datatable-core = { path = "./yew-datatable-core", version = "0.2.0" } -yew-datatable = { path = "./yew-datatable", version = "0.2.0" } +yew-datatable-core = { path = "./yew-datatable-core", version = "0.2.1" } +yew-datatable = { path = "./yew-datatable", version = "0.2.1" } # Yew framework for WebAssembly frontend development. yew = { version = "0.23.0", features = ["csr"] } diff --git a/yew-datatable/src/components/table_body.rs b/yew-datatable/src/components/table_body.rs index 09e8799..9d9cde9 100644 --- a/yew-datatable/src/components/table_body.rs +++ b/yew-datatable/src/components/table_body.rs @@ -37,8 +37,9 @@ pub struct TableBodyProps { /// Compares `TableBodyProps` by all fields, including the table handle. /// -/// The `render_cell` callback is always treated as changed when present, -/// since `Callback` does not implement `PartialEq`. +/// The `render_cell` callback is compared through `Callback`'s `PartialEq`, +/// which is pointer equality on the inner `Rc`, so the body memoizes +/// correctly and re-renders only when the callback identity changes. impl PartialEq for TableBodyProps { fn eq(&self, other: &Self) -> bool { // Compare the table handle for reactivity-aware equality. @@ -49,9 +50,8 @@ impl PartialEq for TableBodyProps { && self.td_class == other.td_class && self.selected_class == other.selected_class && self.selectable == other.selectable - // Callbacks cannot be compared; assume changed if either side has one. - && self.render_cell.is_none() - && other.render_cell.is_none() + // Compare the cell renderer by callback pointer equality. + && self.render_cell == other.render_cell } }