Skip to content

Commit

Permalink
use useMount
Browse files Browse the repository at this point in the history
  • Loading branch information
walterra committed Jan 17, 2024
1 parent 788a4e4 commit 31d5d15
Showing 1 changed file with 4 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,11 @@
* 2.0.
*/

import React, {
createContext,
useContext,
useEffect,
useMemo,
type FC,
type PropsWithChildren,
} from 'react';
import React, { createContext, useContext, useMemo, type FC, type PropsWithChildren } from 'react';
import { configureStore, createSlice } from '@reduxjs/toolkit';
import { useDispatch, Provider } from 'react-redux';
import { bindActionCreators } from 'redux';
import useMount from 'react-use/lib/useMount';

import type { TransformConfigUnion } from '../../../../../common/types/transform';

Expand Down Expand Up @@ -66,10 +60,9 @@ export const EditTransformFlyoutProvider: FC<PropsWithChildren<ProviderProps>> =
const store = useMemo(getReduxStore, []);

// Apply original transform config to redux form state.
useEffect(() => {
useMount(() => {
store.dispatch(editTransformFlyoutSlice.actions.initialize(props));
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
});

return (
<EditTransformFlyoutContext.Provider value={props}>
Expand Down

0 comments on commit 31d5d15

Please sign in to comment.