Skip to content

Commit d0c5705

Browse files
committed
fixes #1009: fix bug when switching between open dialogs
1 parent 4146b82 commit d0c5705

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

lib/src/view/design_dialog_form.dart

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,12 @@ class DesignDialogFormComponent extends UiStatefulComponent2<DesignDialogFormPro
4848
var new_props = typedPropsFactory(nextPropsUntyped);
4949
var prev_state = typedStateFactory(prevStateUntyped);
5050
if (new_props.dialog != null) {
51-
Dialog dialog = new_props.dialog!;
52-
// next if statement is true if the Dialog has just popped up, so user hasn't typed any
53-
// current responses yet, though some may be saved in TODO: saved where?
54-
if (prev_state.current_responses == null) {
51+
// next if statement is true if the Dialog has just popped up,
52+
// OR if the dialog type changes (e.g., if the user has one dialog open and then opens another),
53+
// In either case, user hasn't typed any current responses for this dialog type yet,
54+
// though some may be saved in TODO: saved where?
55+
if (prev_state.current_responses == null || new_props.dialog!.type != prev_state.dialog_type) {
56+
Dialog dialog = new_props.dialog!;
5557
assert(dialog.process_saved_response != null);
5658
var dialog_type = dialog.type;
5759
return newState()

0 commit comments

Comments
 (0)