Skip to content

Commit

Permalink
fix first time load in packs select
Browse files Browse the repository at this point in the history
  • Loading branch information
taronaleksanian committed Oct 22, 2024
1 parent c585f5c commit bddc461
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const PackPickerOverlay: FC<PackPickerOverlayProps> = ({
}) => {
const [searchTerm, setSearchTerm] = useState('');
const user = useAuthUser();
const { data: packs } = useUserPacks(
const { data: packs, isLoading } = useUserPacks(
user?.id,
{ searchTerm, itemId },
'',
Expand All @@ -40,11 +40,11 @@ export const PackPickerOverlay: FC<PackPickerOverlayProps> = ({
};

useEffect(() => {
if (!isLoadedOnce.current && Array.isArray(packs)) {
if (!isLoadedOnce.current && Array.isArray(packs) && !isLoading) {
isLoadedOnce.current = true;
onFirstTimeLoad?.(packs);
}
}, [packs, onFirstTimeLoad]);
}, [packs, onFirstTimeLoad, isLoading]);

return (
<ItemPickerOverlay
Expand Down

0 comments on commit bddc461

Please sign in to comment.