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'
2
2
import { AssetType } from '../../modules/asset/types'
3
3
import { Props } from './AssetProvider.types'
4
4
@@ -18,11 +18,18 @@ const AssetProvider = (props: Props) => {
18
18
isLoadingFeatureFlags
19
19
} = props
20
20
21
+ const [ hasLoadedInitialFlags , setHasLoadedInitialFlags ] = useState ( false )
22
+ useEffect ( ( ) => {
23
+ if ( ! isLoadingFeatureFlags ) {
24
+ setHasLoadedInitialFlags ( true )
25
+ }
26
+ } , [ isLoadingFeatureFlags ] )
27
+
21
28
useEffect ( ( ) => {
22
29
if ( contractAddress && tokenId ) {
23
30
switch ( type ) {
24
31
case AssetType . NFT :
25
- if ( ! isLoadingFeatureFlags ) {
32
+ if ( ! hasLoadedInitialFlags ) {
26
33
onFetchNFT ( contractAddress , tokenId , { rentalStatus } )
27
34
}
28
35
break
@@ -40,7 +47,8 @@ const AssetProvider = (props: Props) => {
40
47
onFetchNFT ,
41
48
onFetchItem ,
42
49
rentalStatus ,
43
- isLoadingFeatureFlags
50
+ isLoadingFeatureFlags ,
51
+ hasLoadedInitialFlags
44
52
] )
45
53
46
54
return (
@@ -49,7 +57,7 @@ const AssetProvider = (props: Props) => {
49
57
asset ,
50
58
order ,
51
59
rental ,
52
- isLoading || ( isLoadingFeatureFlags && type === AssetType . NFT )
60
+ isLoading || ( ! hasLoadedInitialFlags && type === AssetType . NFT )
53
61
) }
54
62
</ >
55
63
)
You can’t perform that action at this time.
0 commit comments