idg.tools icon indicating copy to clipboard operation
idg.tools copied to clipboard

Fix Netlify CMS markdown/relation widget state update issues

Open Greenheart opened this issue 2 years ago • 1 comments

Bug reproduction:

  1. Open an entry in the CMS that contains a relation or markdown widget. For example any tool.
  2. 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

  1. 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
  2. Try to debug the actual issue in Netlify CMS and submit a PR with a fix.

Greenheart avatar Jun 02 '22 20:06 Greenheart