Skip to content

Commit

Permalink
fix(cm): getData redux action can be async
Browse files Browse the repository at this point in the history
Co-Authored-By: DMehaffy <8593673+derrickmehaffy@users.noreply.github.com>
  • Loading branch information
joshuaellis and derrickmehaffy committed Jan 11, 2024
1 parent a3690b1 commit 7fca7d4
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ const ContentTypeFormWrapper = ({
return;
}

dispatch(getData());
await dispatch(getData());

try {
const { data } = await fetchClient.get(requestURL, { cancelToken: source.token });
Expand Down Expand Up @@ -205,7 +205,10 @@ const ContentTypeFormWrapper = ({

// This is needed in order to reset the form when the query changes
const init = async () => {
dispatch(getData());
/**
* TODO: I think there's abuse in the i18n pacakge of redux middleware being asynchronous when it shouldn't be.
*/
await dispatch(getData());
dispatch(initForm(rawQuery));
};

Expand Down

0 comments on commit 7fca7d4

Please sign in to comment.