V2Wizard: Fix wizard initializeWizard action
Fixes #1552. The wizardSlice's initializeWizard action was not working because when it was passed to `dispatch()` as an argument it was missing the `()`... oops! It also needs to be dispatched inside of a useEffect hook with an empty dependency array so that it is only dispatched once, when the wizard opens.
This commit is contained in:
parent
14d80945e7
commit
d26a7658db
1 changed files with 7 additions and 2 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import React from 'react';
|
||||
import React, { useEffect } from 'react';
|
||||
|
||||
import {
|
||||
Button,
|
||||
|
|
@ -56,7 +56,12 @@ const CreateImageWizard = () => {
|
|||
const dispatch = useAppDispatch();
|
||||
|
||||
// IMPORTANT: Ensure the wizard starts with a fresh initial state
|
||||
dispatch(initializeWizard);
|
||||
useEffect(() => {
|
||||
dispatch(initializeWizard());
|
||||
// This useEffect hook should run *only* on mount and therefore has an empty
|
||||
// dependency array. eslint's exhaustive-deps rule does not support this use.
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, []);
|
||||
|
||||
/* *
|
||||
* Selectors *
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue