mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-18 15:44:36 +00:00
bug fix: undefined fetch on page load
This commit is contained in:
1 parent
65580ec502
commit
499c07548c
1 file changed
+11
-11
+11
-11
@@ -1,9 +1,9 @@
|
||||
import { useCallback, useEffect, useState, useRef } from "react";
|
||||
import { useCallback, useState, useRef } from "react";
|
||||
import { FetchStatus } from "~/pages/PageEnigma/enums";
|
||||
import { FetchMediaItemStates, fetchUserMediaItems } from "../utilities";
|
||||
import { FilterEngineCategories, FilterMediaType } from "~/enums";
|
||||
|
||||
import { MAX_FAILED_FETCHES } from "~/constants";
|
||||
// import { MAX_FAILED_FETCHES } from "~/constants";
|
||||
|
||||
interface useUserObjectsProps {
|
||||
defaultErrorMessage: string;
|
||||
@@ -74,15 +74,15 @@ export const useUserObjects = (props: useUserObjectsProps) => {
|
||||
[props],
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (
|
||||
(firstFetch.current === FetchStatus.READY ||
|
||||
firstFetch.current === FetchStatus.ERROR) &&
|
||||
failedFetches.current <= MAX_FAILED_FETCHES
|
||||
) {
|
||||
fetchUserObjects();
|
||||
}
|
||||
}, [fetchUserObjects]);
|
||||
// useEffect(() => {
|
||||
// if (
|
||||
// (firstFetch.current === FetchStatus.READY ||
|
||||
// firstFetch.current === FetchStatus.ERROR) &&
|
||||
// failedFetches.current <= MAX_FAILED_FETCHES
|
||||
// ) {
|
||||
// fetchUserObjects();
|
||||
// }
|
||||
// }, [fetchUserObjects]);
|
||||
|
||||
return {
|
||||
userObjects,
|
||||
|
||||
Reference in new issue
Block a user