Skip to content

Commit 5cf6677

Browse files
committed
fix: unit attributes gets added on reload
1 parent e6294bd commit 5cf6677

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/components/advanced-range-control/index.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,6 @@ const AdvancedRangeControl = props => {
113113
let derivedValue = typeof props.value === 'undefined'
114114
? value : props.value
115115

116-
// Is value at first render the same as a step value? If so, do mark mode
117-
// at the start, or show custom
118-
// If no initial value, use the given default from the settings
119-
const [ isMarkMode, setIsMarkMode ] = useState( false )
120116
// Ensure the convesion of value from preset to custom with regards to the unit is donce once.
121117
const isConversionDone = useRef( false )
122118

@@ -132,6 +128,11 @@ const AdvancedRangeControl = props => {
132128
}
133129
}
134130

131+
// Is value at first render the same as a step value? If so, do mark mode
132+
// at the start, or show custom
133+
// If no initial value, use the given default from the settings
134+
const [ isMarkMode, setIsMarkMode ] = useState( isMarkValue )
135+
135136
// Set the markMode when device type changes
136137
useEffect( () => {
137138
setIsMarkMode( isMarkValue )

src/components/four-range-control/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,6 @@ const FourRangeControl = memo( props => {
189189
: props.enableBottom ? { desktop: _valueDesktop?.bottom, tablet: _valueTablet?.bottom }
190190
: { desktop: _valueDesktop?.left, tablet: _valueTablet?.left }
191191

192-
const [ isFourMarkMode, setIsFourMarkMode ] = useState( false )
193192
// Ensure the convesion of value from preset to custom with regards to the unit is donce once.
194193
const isConversionDone = useRef( {
195194
first: false,
@@ -232,6 +231,8 @@ const FourRangeControl = memo( props => {
232231
} )
233232
}
234233

234+
const [ isFourMarkMode, setIsFourMarkMode ] = useState( isMarkValue )
235+
235236
// Set the markMode when device type changes
236237
useEffect( () => {
237238
setIsFourMarkMode( isMarkValue )

0 commit comments

Comments
 (0)