Skip to main content

Hi,

after calling `updateDraft` from our composer plugin, the composer does not work properly any more. This happens even if I keep the current draft HTML without modifying it at all. Breakage we’ve seen:

  • Cut/paste does not work any more
  • Templates do not insert any more
  • Templates insert at the wrong location
  • Errors in JavaScript console

Would you be able to look into it?

Best
Richard

Hi Richard,

Happy to help with this!  Would you please share the JavaScript errors you see and a code stub where you call updateDraft?


Hi Evan,

Here is the code that does not change the content and still reproduces the issue: https://gist.github.com/neelance/0154c6fd97f80cad0d8e533d4531456a

I can’t send the JS error, because most of the time there is none, it just behaves in a broken way. When triggering the issue repeatedly, I managed to cause a JS error some time ago. Please already try to reproduce it without looking for an error, because it is already broken if there is no error yet.


Hi Richard,

Unfortunately, I won’t be able to assist with that limited of a code stub and no console error.  In the meantime, I suggest you check the working example that we built and tested about two hours ago:

https://github.com/dugjason/front-plugin-tanstack-start/blob/main/src/components/update-draft.tsx


Hi Evan,

I now used your example code for reproducing the issue. Here is how I can reproduce the issue quite reliably:
1. Change “updateMode” to “replace”
2. Reload
3. Push the “Update Draft” button twice
4. Observe that you now can not use the “cut” operation on the “This is a draft” text.

I hope you can reproduce it now. Please tell me if not.


Hi Richard,

I was able to duplicate that behavior and I’ve raised this as a bug to our engineers.  I’ll follow-up once resolved.  I recommend using “insert” until that point, as it doesn’t seem to have the same issue in testing.


Hi Evan,

That’s great. Thanks for looking into it.

Unfortunately using “insert” is not really an option for our use-case. Looking forward to your fix.

Best
Richard


Reply