pixiebrix-extension
pixiebrix-extension copied to clipboard
Mod component shows as unsaved/dirty after clearing changes
Describe the bug
- Mod component shows as unsaved/dirty after clearing changes
- Discussion: https://pixiebrix.slack.com/archives/C0436P48QHY/p1729879942759189
To Reproduce
Steps to Reproduce:
- For an activated mod
- Change the name of a mod component in the Page Editor
- Click Clear Changes for the mod component
Actual behavior
The changes are cleared in the form state, but the component still shows a red disk icon
Expected behavior
The component does not show a red disk icon
Discussion
- From the UI it looks like the mod component might be getting correctly set at clean and then getting marked as dirty
- If you click Clear Changes on the mod and then click into the mod components, they also get marked as dirty. So I suspect for these mods there’s some
useEffectnormalization causing them to become dirty
- If you click Clear Changes on the mod and then click into the mod components, they also get marked as dirty. So I suspect for these mods there’s some
- If the editor is performing
useEffectsto normalize the state this is potentially the "correct" behavior in that the brick is being modified (although non-functionally) when the user clicks into it
Desktop (please complete the following information):
- Extension Version: 2.1.6-beta.1
Related Code
- https://github.com/pixiebrix/pixiebrix-extension/blob/e092de96b6bac94f96724e3a46e1dda306fcd3a8/src/pageEditor/hooks/useClearModComponentChanges.ts#L77-L77
It's unclear how/why Formik is setting the form state (logs from turning on redux loggers diff feature):
This could be related to reinitializing the form instead of remounting