add some more safety checks to composer
This commit is contained in:
parent
dbc42b0ec2
commit
06ba23d3c0
1 changed files with 6 additions and 1 deletions
|
|
@ -204,7 +204,12 @@ class const Composer(
|
||||||
// the controller, which is also told about the draft being restored
|
// the controller, which is also told about the draft being restored
|
||||||
// during the build
|
// during the build
|
||||||
void onFormattedTextChanged(String text) {
|
void onFormattedTextChanged(String text) {
|
||||||
if (text == ref.read(draftProvider).text) return;
|
final draft = ref.read(draftProvider);
|
||||||
|
if (text == draft.text ||
|
||||||
|
(draft.isEditing ? draft.relatedEvent : null) != editingEvent) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
draftNotifier.update(
|
draftNotifier.update(
|
||||||
(draft) => draft.copyWith(text: text, tags: controller.tags.toIList()),
|
(draft) => draft.copyWith(text: text, tags: controller.tags.toIList()),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue