Skip to content

Commit

Permalink
Address minor comment
Browse files Browse the repository at this point in the history
Signed-off-by: Prabhat Sharma <[email protected]>
  • Loading branch information
Prabhat Sharma committed Apr 8, 2024
1 parent ba276a1 commit 4173124
Showing 1 changed file with 3 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export enum Radio {

export class ChangePolicy extends Component<ChangePolicyProps, ChangePolicyState> {
static contextType = CoreServicesContext;
state: ChangePolicyState = {
static emptyState = {
selectedPolicies: [],
selectedManagedIndices: [],
selectedStateFilters: [],
Expand All @@ -50,6 +50,7 @@ export class ChangePolicy extends Component<ChangePolicyProps, ChangePolicyState
selectedPoliciesError: "",
hasSubmitted: false,
};
state: ChangePolicyState = ChangePolicy.emptyState;

async componentDidMount(): Promise<void> {
this.context.chrome.setBreadcrumbs([BREADCRUMBS.INDEX_MANAGEMENT, BREADCRUMBS.MANAGED_INDICES, BREADCRUMBS.CHANGE_POLICY]);
Expand All @@ -59,14 +60,7 @@ export class ChangePolicy extends Component<ChangePolicyProps, ChangePolicyState
if (prevProps.dataSourceId !== this.props.dataSourceId) {
// reset the state, if dataSourceId changes, i.e., clear state
this.setState({
selectedPolicies: [],
selectedManagedIndices: [],
selectedStateFilters: [],
stateRadioIdSelected: Radio.Current,
stateSelected: "",
managedIndicesError: "",
selectedPoliciesError: "",
hasSubmitted: false,
...ChangePolicy.emptyState,
});
}
}
Expand Down

0 comments on commit 4173124

Please sign in to comment.