2023-12-29 03:05:56 +00:00
|
|
|
import { PropsWithChildren, memo, useEffect } from 'react';
|
2023-12-28 13:03:21 +00:00
|
|
|
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';
|
2023-12-28 13:03:21 +00:00
|
|
|
/**
|
|
|
|
* 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) => {
|
2023-12-28 13:03:21 +00:00
|
|
|
const dispatch = useAppDispatch();
|
|
|
|
useGlobalModifiersInit();
|
|
|
|
useEffect(() => {
|
2024-02-16 07:56:02 +00:00
|
|
|
dispatch(modelChanged({ key: 'test_model', base: 'sd-1' }));
|
2023-12-28 13:03:21 +00:00
|
|
|
}, []);
|
|
|
|
|
|
|
|
return props.children;
|
2023-12-29 03:05:56 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
ReduxInit.displayName = 'ReduxInit';
|