fix bugs
This commit is contained in:
@@ -17,6 +17,12 @@ export function useGameFilter(
|
||||
const [fetchedTitles, setFetchedTitles] = useState<string[]>([]);
|
||||
const metaDataRef = useRef<{ [key: string]: GameProto }>({});
|
||||
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
metaDataRef.current = {};
|
||||
};
|
||||
}, []);
|
||||
|
||||
const { gameToNegative, gameToPositiveOpinion } = useMemo(() => {
|
||||
const gameToNegative = new Map<string, Set<string>>();
|
||||
const gameToPositiveOpinion = new Map<string, Set<string>>();
|
||||
@@ -108,7 +114,7 @@ export function useGameFilter(
|
||||
|
||||
const gamesMap = useMemo(() => {
|
||||
return new Map(Object.entries(metaDataRef.current));
|
||||
}, [fetchedTitles]);
|
||||
}, []);
|
||||
|
||||
return { filteredGames, gameToPositive: gameToPositiveOpinion, games: gamesMap };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user