File tree Expand file tree Collapse file tree 1 file changed +3
-6
lines changed
Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -45,17 +45,14 @@ const AssetValue = ({
4545 const hasCurrent = Boolean ( exchangeRate ) ;
4646 const hasToggle = hasHistoric && hasCurrent && hasExchangeRateToggle && amount !== '0' ;
4747
48- const [ showHistoric , setShowHistoric ] = React . useState ( hasHistoric ) ;
49-
50- React . useEffect ( ( ) => {
51- setShowHistoric ( hasHistoric ) ;
52- } , [ hasHistoric ] ) ;
48+ const [ showHistoricOverride , setShowHistoricOverride ] = React . useState < boolean | undefined > ( undefined ) ;
49+ const showHistoric = hasHistoric && ( showHistoricOverride ?? true ) ;
5350
5451 const activeExchangeRate = showHistoric ? historicExchangeRate : exchangeRate ;
5552
5653 const handleToggle = React . useCallback ( ( ) => {
5754 if ( hasToggle ) {
58- setShowHistoric ( prev => ! prev ) ;
55+ setShowHistoricOverride ( prev => ( prev === undefined ? false : ! prev ) ) ;
5956 }
6057 } , [ hasToggle ] ) ;
6158
You can’t perform that action at this time.
0 commit comments