Only watch changes for specific columns #2727
-
I was hoping that if I write: selectOnly()..addColumns([users.name, ...]).watch() And I update columns that I'm not watching, the stream events would not trigger. But actually the stream triggers in any update of the table. Am I doing something wrong or is this intended design ? Possible related : #2477 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
This is the indented design, often we have no way of knowing which exact columns were updated in which rows. So streams are designed to not miss any updates, but they can fire more often than strictly necessary. |
Beta Was this translation helpful? Give feedback.
This is the indented design, often we have no way of knowing which exact columns were updated in which rows. So streams are designed to not miss any updates, but they can fire more often than strictly necessary.
If the row type you're mapping to (you can also use a Dart record) implements
equals
, you can use.distinct(const ListEquality().equals)
on the stream to avoid notifying listeners when nothing has changed.