Skip to content

Commit

Permalink
Merge pull request #314 from aura-nw/fix/remove-safe-load
Browse files Browse the repository at this point in the history
fix remove safe load failed
  • Loading branch information
hoangndm3139 authored Aug 31, 2023
2 parents 6fabf6f + 553a1ee commit 0909362
Showing 1 changed file with 18 additions and 22 deletions.
40 changes: 18 additions & 22 deletions src/routes/safe/index.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
import { GenericModal, Loader } from '@aura/safe-react-components'
import { GenericModal } from '@aura/safe-react-components'
import { lazy, useEffect, useState } from 'react'
import { useDispatch, useSelector } from 'react-redux'
import { Redirect, Route, Switch } from 'react-router-dom'

import { FEATURES } from '@gnosis.pm/safe-react-gateway-sdk'
import { LoadingContainer } from 'src/components/LoaderContainer'
import { fetchAllDelegations } from 'src/logic/delegation/store/actions'
import { currentSafeFeaturesEnabled, currentSafeOwners } from 'src/logic/safe/store/selectors'
import { extractPrefixedSafeAddress, generateSafeRoute, SAFE_ROUTES } from 'src/routes/routes'
import { SAFE_POLLING_INTERVAL } from 'src/utils/constants'
import { wrapInSuspense } from 'src/utils/wrapInSuspense'
import SafeLoadError from './components/SafeLoadError'
import ContractInteraction from 'src/pages/SmartContract/ContractInteraction'
import CustomTransaction from 'src/pages/Avanced/Custom Transaction'
import Assets from 'src/pages/Assets'
Expand All @@ -34,20 +31,19 @@ const Container = (): React.ReactElement => {
const featuresEnabled = useSelector(currentSafeFeaturesEnabled)
const owners = useSelector(currentSafeOwners)
const isSafeLoaded = owners.length > 0
const [hasLoadFailed, setHasLoadFailed] = useState<boolean>(false)
// const [hasLoadFailed, setHasLoadFailed] = useState<boolean>(false)
const dispatch = useDispatch()
useEffect(() => {
if (isSafeLoaded) {
dispatch(fetchAllDelegations())
return
}

const failedTimeout = setTimeout(() => {
setHasLoadFailed(true)
}, SAFE_POLLING_INTERVAL)
return () => {
clearTimeout(failedTimeout)
}
// const failedTimeout = setTimeout(() => {
// setHasLoadFailed(true)
// }, SAFE_POLLING_INTERVAL)
// return () => {
// clearTimeout(failedTimeout)
// }
}, [isSafeLoaded])

const [modal, setModal] = useState({
Expand All @@ -58,17 +54,17 @@ const Container = (): React.ReactElement => {
onClose: () => {},
})

if (hasLoadFailed) {
return <SafeLoadError />
}
// if (hasLoadFailed) {
// return <SafeLoadError />
// }

if (!isSafeLoaded) {
return (
<LoadingContainer>
<Loader size="md" />
</LoadingContainer>
)
}
// if (!isSafeLoaded) {
// return (
// <LoadingContainer>
// <Loader size="md" />
// </LoadingContainer>
// )
// }

const closeGenericModal = () => {
if (modal.onClose) {
Expand Down

0 comments on commit 0909362

Please sign in to comment.