From 05121fbdba8a5a3e91077563ccb904c475b5332f Mon Sep 17 00:00:00 2001 From: Dana Lambert Date: Tue, 2 Nov 2021 11:30:36 +1300 Subject: [PATCH] Update reset operation to also reset filters --- frontend/src/components/Stepper.js | 1 + frontend/src/pages/MainPage.js | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/Stepper.js b/frontend/src/components/Stepper.js index fff836c..b44aedb 100644 --- a/frontend/src/components/Stepper.js +++ b/frontend/src/components/Stepper.js @@ -40,6 +40,7 @@ export default function StepperWizard(props) { const handleReset = () => { setActiveStep(0); setNextDisabled(true); + props.resetFilterState() }; let CurrentStep = activeStep >= steps.length ? steps[steps.length - 1].component : steps[activeStep].component; diff --git a/frontend/src/pages/MainPage.js b/frontend/src/pages/MainPage.js index a39ce39..bc5f5a6 100644 --- a/frontend/src/pages/MainPage.js +++ b/frontend/src/pages/MainPage.js @@ -16,6 +16,7 @@ export default class MainPage extends React.Component { } this.updateFilterState = this.updateFilterState.bind(this); + this.resetFilterState = this.resetFilterState.bind(this); } updatePlants() { @@ -33,6 +34,10 @@ export default class MainPage extends React.Component { this.updatePlants() } + resetFilterState() { + this.setState({ filters: {} }) + } + componentDidMount() { this.updatePlants() } @@ -41,7 +46,11 @@ export default class MainPage extends React.Component { return (
- + ) }