InvokeAI/invokeai/frontend/web/.storybook/ReduxInit.tsx

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

20 lines
686 B
TypeScript
Raw Permalink Normal View History

2023-12-29 03:05:56 +00:00
import { PropsWithChildren, memo, useEffect } from 'react';
import { modelChanged } from '../src/features/parameters/store/generationSlice';
import { useAppDispatch } from '../src/app/store/storeHooks';
2024-01-27 09:53:32 +00:00
import { useGlobalModifiersInit } from '@invoke-ai/ui-library';
/**
* Initializes some state for storybook. Must be in a different component
* so that it is run inside the redux context.
*/
2023-12-29 03:05:56 +00:00
export const ReduxInit = memo((props: PropsWithChildren) => {
const dispatch = useAppDispatch();
useGlobalModifiersInit();
useEffect(() => {
dispatch(modelChanged({ key: 'test_model', base: 'sd-1' }));
}, []);
return props.children;
2023-12-29 03:05:56 +00:00
});
ReduxInit.displayName = 'ReduxInit';