Skip to content

Commit

Permalink
✨ feat(component-asset): 优化 createTestAssetStore ,便于下游测试
Browse files Browse the repository at this point in the history
  • Loading branch information
arvinxx committed Jun 15, 2023
1 parent e8a61f3 commit e58eb84
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/ComponentAsset/store/createTestAssetStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@ export const createTestAssetStore = <T>(createStore: CreateAssetStore<T>) => {
const useAssetStore = create<T>(createStore);
const { getConfig, setConfig } = useEditorStore.getState();

useAssetStore.setState({ getConfig, setConfig } as any);
const init = () => {
useAssetStore.setState({ getConfig, setConfig } as any);

useEditorStore.subscribe(({ config }) => {
useAssetStore.setState(config);
});
useEditorStore.subscribe(({ config }) => {
useAssetStore.setState(config);
});
};

return useAssetStore;
return { useAssetStore, init, useEditorStore };
};

0 comments on commit e58eb84

Please sign in to comment.