Repository navigation
Conversation
memo_distinct_needs_identity_equality reports a StoreConnector with distinct: true whose converter returns a Memo value of its view model, when that view model is @freezed without equal: false and has a list, map, set or other iterable field. The memo already hands back the same instance while nothing changed, so freezed's deep == only re-walks every item after each change. A view model of scalars, or one built anew on every call, is left alone, as value equality is what serves it. cb-mobile main has three such view models (appointment_items, invoice_payments_container, selected_invoice_container), so this needs them fixed before it lands. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01UESkdYVqQ7NhmMmMfG7ov2
Collaborator
Author
|
Closing without merging. The three view models this rule reports in cb-mobile (appointment items, invoice payments, selected invoice) are memoized, and their value equality is deliberate: when the memo recomputes for an unrelated change, the new lists hold the same instances, so comparing them costs one identity check per item and spares the rebuild. With equal: false they would rebuild on every such change. cb-mobile's CLAUDE.md now says when value equality is the right choice. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
memo_distinct_needs_identity_equality: aStoreConnectorwithdistinct: truewhose converter returns a memoized view model that is freezed with value equality and holds a List, Map, Set or Iterable. Thendistinctdeep-compares every item on every action, which CLAUDE.md's "Converters run on every action" rules out with@Freezed(equal: false).It reports three view models on cb-mobile main today:
appointment_items.dart:37,invoice_payments_container.dart:36andselected_invoice_container.dart:48. The cb-mobile MR that pins this release fixes all three, so it ships together with the fix.Testing
./check.shpasses, with the rule's 11 tests, and the fixture draws it. On cb-mobile main it reports exactly those three, from a rootdart analyze.🤖 Generated with Claude Code
https://claude.ai/code/session_01UESkdYVqQ7NhmMmMfG7ov2