MCPcopy Create free account
hub / github.com/Gin-Quin/gravity / createStore

Function createStore

packages/gravity-react/source/createStore.ts:10–22  ·  view source on GitHub ↗
(fetcher)

Source from the content-addressed store, hash-verified

8export const createStore: DefineStoreInterface<
9 Store<unknown>
10>["createStore"] = (fetcher) => {
11 const store = createZustandStore<StoreData<unknown>>((set) => ({
12 ...createStoreData(),
13 refresh: async () => {
14 set(() => ({ isRefreshing: true }));
15 for await (const data of fetcher()) {
16 set(() => updateStoreData(<StoreData<unknown>>{}, data));
17 }
18 set(() => ({ isRefreshing: false }));
19 },
20 }));
21 return store;
22};

Callers

nothing calls this directly

Calls 3

createStoreDataFunction · 0.90
updateStoreDataFunction · 0.90
setFunction · 0.85

Tested by

no test coverage detected