Open LucunJi opened 2 weeks ago
3.5.0+1.21-fabric
As the title says, it simply prevents saving in all cases.
OptionImpl#requestSet
binding().getValue()
pendingValue
OptionImpl#triggerListeners
OptionImpl#applyValue
YACLScreen#onOptionChanged
pendingChanges
false
Now the configs won't be the saved since the pendingChanges is false. BROKEN.
true
It looks fine, but what if we are pressing the Reset button, and the last option hasn't been changed?
Keep track of the initial value, use a "dirty" flag, etc.
A potential patch is proposed here (I used mixins in my project)
3.5.0+1.21-fabric
How to reproduce
As the title says, it simply prevents saving in all cases.
Analysis
Case 1: the common scenario
OptionImpl#requestSet
:binding().getValue()
andpendingValue
differs; also callsOptionImpl#triggerListeners
OptionImpl#applyValue
:binding().getValue()
andpendingValue
becomes the sameYACLScreen#onOptionChanged
:pendingChanges
isfalse
Now the configs won't be the saved since the
pendingChanges
isfalse
. BROKEN.Case 2: intentionally swap step 2 and 3, it won't be fixed
OptionImpl#requestSet
:binding().getValue()
andpendingValue
differs; also callsOptionImpl#triggerListeners
YACLScreen#onOptionChanged
:pendingChanges
istrue
OptionImpl#applyValue
:binding().getValue()
andpendingValue
becomes the sameIt looks fine, but what if we are pressing the Reset button, and the last option hasn't been changed?
OptionImpl#requestSet
:binding().getValue()
andpendingValue
are still the sameYACLScreen#onOptionChanged
:pendingChanges
isfalse
OptionImpl#applyValue
:binding().getValue()
andpendingValue
are still the sameNow the configs won't be the saved since the
pendingChanges
isfalse
. BROKEN.How to fix it
Keep track of the initial value, use a "dirty" flag, etc.