// Note: This is the only way i've found for the state to propagate when the store changes
const { data: remoteStore, status: storeStatus } = useQuery({
queryKey: kStore(context.activity),
queryFn: () => getProgress({ ctx: context, config }), // Returns the ModuleStore of the server
cacheTime: 2.628e9, // 2 months
})
const [store, setStore] = useState<ModuleStore>(remoteStore ?? {})
useEffect(() => {
if (remoteStore && storeStatus === "success") setStore(remoteStore)
}, [remoteStore])
// Note: This is the only way i've found for the state to propagate when the store changes
const { data: remoteStore, status: storeStatus } = useQuery({
queryKey: kStore(context.activity),
queryFn: () => getProgress({ ctx: context, config }), // Returns the ModuleStore of the server
cacheTime: 2.628e9, // 2 months
})
const [store, setStore] = useState<ModuleStore>(remoteStore ?? {})
useEffect(() => {
if (remoteStore && storeStatus === "success") setStore(remoteStore)
}, [remoteStore])