Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Commit

Permalink
fix: πŸ› create variant status was not correctly initialised
Browse files Browse the repository at this point in the history
When creating a new variant, the variant create dialog status was not
resetted and was still showing data from the previously created variant
  • Loading branch information
ziccardi authored and secondsun committed Sep 16, 2020
1 parent f446b1d commit 34a4d37
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions src/application/VariantForms/VariantSelectionForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,25 @@ interface Props {
onFinished: (variant: Variant | undefined) => void;
}

const initialState : State = {
variantName: '',
androidVariantForm: false,
webpushVariantForm: false,
iosTokenVariantForm: false,
iosCertificateVariantForm: false,
variantType: 'android',
};

export class VariantSelectionForm extends Component<Props, State> {
constructor(props: Props) {
super(props);
this.state = {
variantName: '',
androidVariantForm: false,
webpushVariantForm: false,
iosTokenVariantForm: false,
iosCertificateVariantForm: false,
variantType: 'android',
};
this.state = {...initialState};
}

componentDidUpdate(prevProps: Readonly<Props>, prevState: Readonly<State>) {
if (prevProps.open && !this.props.open) {
this.setState( initialState );
}
}

render(): React.ReactNode {
Expand Down

0 comments on commit 34a4d37

Please sign in to comment.