Skip to content

Commit

Permalink
Merge pull request #720 from akto-api-security/fix/fix_onboarding_bug
Browse files Browse the repository at this point in the history
Fixed typo to solve infinite loop on loading page on new page
  • Loading branch information
avneesh-akto authored Nov 14, 2023
2 parents 4105caa + a4834be commit c213891
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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)

Expand All @@ -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));
})
}

Expand Down

0 comments on commit c213891

Please sign in to comment.