Skip to content

Commit

Permalink
fix(helm): Fix helm artifacts not updating name and vesions (#8455)
Browse files Browse the repository at this point in the history
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
Jossuecito and mergify[bot] committed Aug 3, 2020
1 parent 9503258 commit 92eeb4f
Showing 1 changed file with 34 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,22 @@ class HelmEditor extends React.Component<IArtifactEditorProps, IHelmArtifactEdit
props.onChange(clonedArtifact);
}

ArtifactService.getArtifactNames(TYPE, this.props.account.name).then(names => {
this.setState({
names,
namesLoading: false,
});
});
ArtifactService.getArtifactNames(TYPE, this.props.account.name).then(
names => {
this.setState({
names,
namesLoading: false,
});
},
() => {
this.setState({
names: [],
namesLoading: false,
versionsLoading: false,
versions: [],
});
},
);
}

public componentDidMount() {
Expand All @@ -55,15 +65,24 @@ class HelmEditor extends React.Component<IArtifactEditorProps, IHelmArtifactEdit
}
}

public componentDidUpdate(nextProps: IArtifactEditorProps) {
if (this.props.account.name !== nextProps.account.name) {
ArtifactService.getArtifactNames(TYPE, nextProps.account.name).then(names => {
this.setState({
names,
namesLoading: false,
versions: [],
});
});
public componentDidUpdate(prevProps: IArtifactEditorProps) {
if (this.props.account.name !== prevProps.account.name) {
ArtifactService.getArtifactNames(TYPE, this.props.account.name).then(
names => {
this.setState({
names,
namesLoading: false,
versions: [],
});
},
() => {
this.setState({
names: [],
namesLoading: false,
versions: [],
});
},
);
}
}

Expand Down

0 comments on commit 92eeb4f

Please sign in to comment.