From a4834be86d1e2621d1e3fe09b1c78560b3af67db Mon Sep 17 00:00:00 2001 From: Ark2307 Date: Tue, 14 Nov 2023 22:11:17 +0530 Subject: [PATCH] Fixed typo to solve infinite loop on loading page on new page --- .../pages/onboarding/components/CollectionSelection.jsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/onboarding/components/CollectionSelection.jsx b/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/onboarding/components/CollectionSelection.jsx index 51e48a8e2b..fa5b268911 100644 --- a/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/onboarding/components/CollectionSelection.jsx +++ b/apps/dashboard/web/polaris_web/web/src/apps/dashboard/pages/onboarding/components/CollectionSelection.jsx @@ -1,5 +1,4 @@ import React, { useEffect, useState } from 'react' -import Store from "../../../store" import homeRequests from '../../home/api' import OnboardingStore from '../OnboardingStore' import DropdownSearch from '../../../components/shared/DropdownSearch' @@ -9,7 +8,7 @@ import PersistStore from '../../../../main/PersistStore' function CollectionSelection() { const apiCollections = PersistStore(state => state.allCollections) - const setCollections = Store(state => state.setAllCollections) + const setCollections = PersistStore(state => state.setAllCollections) const setSelectedCollection = OnboardingStore(state => state.setSelectedCollection) const collection = OnboardingStore(state => state.selectedCollection) @@ -36,10 +35,10 @@ function CollectionSelection() { const getCollections = async()=> { let interval = setInterval(async () => { let localCopy = [] - if(apiCollections.length <= 1){ + if(apiCollections.length <= 1 && localCopy.length <= 1){ await homeRequests.getCollections().then((resp)=> { setCollections(resp.apiCollections) - localCopy = resp.apiCollections + localCopy = JSON.parse(JSON.stringify(resp.apiCollections)); }) }