Skip to content

Commit 0bf96b7

Browse files
committed
Reset state upon closing dialog to create branch
1 parent a0099b1 commit 0bf96b7

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

src/components/NewBranchDialog.tsx

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ export class NewBranchDialog extends React.Component<
136136
paper: branchDialogClass
137137
}}
138138
open={this.props.open}
139-
onClose={this.props.onClose}
139+
onClose={this._onClose}
140140
aria-labelledby="new-branch-dialog"
141141
>
142142
<div className={titleWrapperClass}>
@@ -145,7 +145,7 @@ export class NewBranchDialog extends React.Component<
145145
<ClearIcon
146146
titleAccess="Close this dialog"
147147
fontSize="small"
148-
onClick={this.props.onClose}
148+
onClick={this._onClose}
149149
/>
150150
</button>
151151
</div>
@@ -191,7 +191,7 @@ export class NewBranchDialog extends React.Component<
191191
type="button"
192192
title="Close this dialog without creating a new branch"
193193
value="Cancel"
194-
onClick={this.props.onClose}
194+
onClick={this._onClose}
195195
/>
196196
<input
197197
className={classes(buttonClass, createButtonClass)}
@@ -312,6 +312,19 @@ export class NewBranchDialog extends React.Component<
312312
});
313313
}
314314

315+
/**
316+
* Callback invoked upon closing the dialog.
317+
*
318+
* @param event - event object
319+
*/
320+
private _onClose = (): void => {
321+
this.props.onClose();
322+
this.setState({
323+
name: '',
324+
filter: ''
325+
});
326+
};
327+
315328
/**
316329
* Callback invoked upon a change to the menu filter.
317330
*

0 commit comments

Comments
 (0)