File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
webapp/src/components/AssetProvider Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change 1- import React , { useEffect } from 'react'
1+ import React , { useEffect , useState } from 'react'
22import { AssetType } from '../../modules/asset/types'
33import { Props } from './AssetProvider.types'
44
@@ -18,11 +18,18 @@ const AssetProvider = (props: Props) => {
1818 isLoadingFeatureFlags
1919 } = props
2020
21+ const [ hasLoadedInitialFlags , setHasLoadedInitialFlags ] = useState ( false )
22+ useEffect ( ( ) => {
23+ if ( ! isLoadingFeatureFlags ) {
24+ setHasLoadedInitialFlags ( true )
25+ }
26+ } , [ isLoadingFeatureFlags ] )
27+
2128 useEffect ( ( ) => {
2229 if ( contractAddress && tokenId ) {
2330 switch ( type ) {
2431 case AssetType . NFT :
25- if ( ! isLoadingFeatureFlags ) {
32+ if ( ! hasLoadedInitialFlags ) {
2633 onFetchNFT ( contractAddress , tokenId , { rentalStatus } )
2734 }
2835 break
@@ -40,7 +47,8 @@ const AssetProvider = (props: Props) => {
4047 onFetchNFT ,
4148 onFetchItem ,
4249 rentalStatus ,
43- isLoadingFeatureFlags
50+ isLoadingFeatureFlags ,
51+ hasLoadedInitialFlags
4452 ] )
4553
4654 return (
@@ -49,7 +57,7 @@ const AssetProvider = (props: Props) => {
4957 asset ,
5058 order ,
5159 rental ,
52- isLoading || ( isLoadingFeatureFlags && type === AssetType . NFT )
60+ isLoading || ( ! hasLoadedInitialFlags && type === AssetType . NFT )
5361 ) }
5462 </ >
5563 )
You can’t perform that action at this time.
0 commit comments