idg.tools
idg.tools copied to clipboard
Fix Netlify CMS markdown/relation widget state update issues
Bug reproduction:
- Open an entry in the CMS that contains a
relation
ormarkdown
widget. For example any tool. - After 0.5 seconds, the top left button changes state and label to a red "UNSAVED CHANGES", despite nothing being edited yet.
Expected behavior
The top left button should not display the incorrect UNSAVED CHANGES
, and the CMS should not prompt users to confirm before leaving the page.
Impact
This is quite serious since it will prevent the editorial_workflow
mode in Netlify CMS from publishing changes, which is a bad UX for content co-creators.
Potential bug causes and research
- Seems to be related to https://github.com/netlify/netlify-cms/issues/3039 and https://github.com/netlify/netlify-cms/issues/2211
- Maybe caused by additional state updates triggered by the markdown or relation widgets. Or by custom components.
Potential workarounds
-
Maybe use a custom wrapper component to only trigger the
onChange
handler on actual content changes. https://github.com/netlify/netlify-cms/issues/2211#issuecomment-570063083- This might be possible to use both the relation and markdown widgets
-
Try to debug the actual issue in Netlify CMS and submit a PR with a fix.