While working on #122, I noticed this bug on main when trying to fix the warning associated with the preview format removal feature. This seems to have been introduced in #116, where a change was made to use useRef to keep track of value changes. The fix presented here takes the best of the past solutions:
Keep valueRef to keep track of previous value, but simplify as we don't really need lastValue state
Favor handleTextFormatRemoval instead of removesPreviewFormat as the former is more robust
This PR also actually fixes the warning that came with the previous solution
https://phabricator.wikimedia.org/T367115
While working on #122, I noticed this bug on main when trying to fix the warning associated with the preview format removal feature. This seems to have been introduced in #116, where a change was made to use
useRef
to keep track ofvalue
changes. The fix presented here takes the best of the past solutions:valueRef
to keep track of previous value, but simplify as we don't really needlastValue
statehandleTextFormatRemoval
instead ofremovesPreviewFormat
as the former is more robustPlease test carefully