Skip to content

Commit 480126e

Browse files
Enhance ThemedTable2 with performance improvements and tests (#128)
This pull request focuses on improving the reliability, performance, and test coverage of the `ThemedTable2` widget in the `layrz_theme` Flutter library. The changes address critical issues like column key collisions, update loss during loading, and isolate safety for closures, while also optimizing multi-select and widget update performance. All debug logging has been removed from the core filtering and sorting logic, and comprehensive widget tests have been added. **Bug fixes:** * Fixed column key collision in `_itemsStrings` by using column index instead of `col.hashCode`, preventing silent data corruption when columns share the same `headerText`. [[1]](diffhunk://#diff-5b9ef11e8406724411bc47df7bacb49b59952951fd8bdd7628101cf5d723be40L167-R170) [[2]](diffhunk://#diff-5b9ef11e8406724411bc47df7bacb49b59952951fd8bdd7628101cf5d723be40R691-R694) [[3]](diffhunk://#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4edR3-R13) * Fixed silent update loss: updates arriving while loading are now queued via a `_pendingUpdate` flag and processed after the current operation completes. [[1]](diffhunk://#diff-5b9ef11e8406724411bc47df7bacb49b59952951fd8bdd7628101cf5d723be40R184-R193) [[2]](diffhunk://#diff-5b9ef11e8406724411bc47df7bacb49b59952951fd8bdd7628101cf5d723be40L222-R242) [[3]](diffhunk://#diff-5b9ef11e8406724411bc47df7bacb49b59952951fd8bdd7628101cf5d723be40L233-R299) [[4]](diffhunk://#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4edR3-R13) * Fixed unsendable closure crash: sort keys are now precomputed on the main thread before `compute()`, ensuring `valueBuilder` closures that capture `BuildContext` or i18n objects never cross the isolate boundary. [[1]](diffhunk://#diff-5b9ef11e8406724411bc47df7bacb49b59952951fd8bdd7628101cf5d723be40L233-R299) [[2]](diffhunk://#diff-5b9ef11e8406724411bc47df7bacb49b59952951fd8bdd7628101cf5d723be40L874-R952) [[3]](diffhunk://#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4edR3-R13) **Performance improvements:** * Improved multi-select performance by introducing an internal `Set<T>` mirroring `_selectedItems` for O(1) `contains()` lookups, replacing previous O(n) checks. [[1]](diffhunk://#diff-5b9ef11e8406724411bc47df7bacb49b59952951fd8bdd7628101cf5d723be40R184-R193) [[2]](diffhunk://#diff-5b9ef11e8406724411bc47df7bacb49b59952951fd8bdd7628101cf5d723be40R209) [[3]](diffhunk://#diff-5b9ef11e8406724411bc47df7bacb49b59952951fd8bdd7628101cf5d723be40R318-L308) [[4]](diffhunk://#diff-5b9ef11e8406724411bc47df7bacb49b59952951fd8bdd7628101cf5d723be40L605-R644) [[5]](diffhunk://#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4edR3-R13) * Improved `didUpdateWidget` performance by replacing `DeepCollectionEquality` (O(n)) with a fast O(1) heuristic using `identical` and length checks. [[1]](diffhunk://#diff-5b9ef11e8406724411bc47df7bacb49b59952951fd8bdd7628101cf5d723be40L209-R228) [[2]](diffhunk://#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4edR3-R13) **Codebase cleanup:** * Removed all `debugPrint` statements from `_filterAndSort` and related logic. [[1]](diffhunk://#diff-5b9ef11e8406724411bc47df7bacb49b59952951fd8bdd7628101cf5d723be40L222-R242) [[2]](diffhunk://#diff-5b9ef11e8406724411bc47df7bacb49b59952951fd8bdd7628101cf5d723be40L233-R299) [[3]](diffhunk://#diff-5b9ef11e8406724411bc47df7bacb49b59952951fd8bdd7628101cf5d723be40L323-L324) [[4]](diffhunk://#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4edR3-R13) **Testing and versioning:** * Added comprehensive widget tests for `ThemedTable2`, including regression coverage for key collision, search, sorting, refresh, and widget update scenarios. * Bumped version to `7.5.22` in `pubspec.yaml` and `.claude-plugin/plugin.json`. [[1]](diffhunk://#diff-8b7e9df87668ffa6a04b32e1769a33434999e54ae081c52e5d943c541d4c0d25L3-R3) [[2]](diffhunk://#diff-037fda53525563fb89230704794a06db1150204ca28ce80697a637121c3ed3f9L4-R4)
2 parents e31de4f + 85d103a commit 480126e

7 files changed

Lines changed: 1011 additions & 74 deletions

File tree

.claude-plugin/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"name": "layrz_theme",
33
"description": "Claude Code skills for layrz_theme Flutter widget library",
4-
"version": "7.5.21"
4+
"version": "7.5.22"
55
}

0 commit comments

Comments
 (0)