formfcw / directus-extension-flexible-editor

A rich text editor (WYSIWYG) with JSON output that allows the integration of M2A relations to make it extremely flexible. A truly rich editor for Directus.
https://www.npmjs.com/package/directus-extension-flexible-editor
GNU General Public License v3.0
141 stars 14 forks source link

No value in flexible editor when the item is opened in a drawer. #25

Closed jdjoshuadavison closed 1 year ago

jdjoshuadavison commented 1 year ago

Describe the bug When you open a related item and it opens in a drawer, the flexible editor fields are always empty, even when there should be content.

To Reproduce

  1. Add 2 fields to a content model: a Flexible Editor and a O2M relationship.
  2. Create an item and add content to the flexible editor. Save and create new.
  3. Creating your second item, add a relationship to the first item. Save and stay.
  4. Viewing your second item, click on the related item (your first item). The first item opens in a drawer, but there is no content in the flexible editor field.

Flexible Editor Version: 1.1.3

Directus Version: 10.6.1

formfcw commented 1 year ago

Thanks for your message. I can’t reproduce your issue. Can you please upgrade Flexible Editor to the latest version and then provide a video or a more detailed description on how to reproduce?

jdjoshuadavison commented 1 year ago

We upgraded to the latest version this morning, we hadn't noticed the problem before then, but can't see definitively that it wasn't a problem before then. I just tested it on a different collection, and the problem isn't present there. So its only occurring on this one specific collection. I'll keep digging and see if I can work out what's different between the 2 collections.

formfcw commented 1 year ago

OK, I will close this for now. Let me know if it is something that needs to be fixed.

jdjoshuadavison commented 1 year ago

I have spent the last 45 minutes doing tests. It is only occurring on this one collection. But there are no errors in browser console. Now errors in the docker logs. The config all looks correct and its working absolutely fine outside of the drawer.

Tomorrow I will take a backup of my database, then start removing things from the content model and see if we can find whats causing it.

Will keep you updated. But if you've got any wild theories, or suggestions on how to debug this, please let me know!

https://github.com/formfcw/directus-extension-flexible-editor/assets/34007858/3113660d-c1b9-446d-adc1-7e2fcef419af

jdjoshuadavison commented 1 year ago

@formfcw Okay, so after a lot of trial and error, I started to think this was a timing issue. It was happening on this specific collection because the data model is the largest one we have. I tested the theory by using a much simpler content model and throttling my network connection (see video at the bottom of this message).

The issue

On complex models, or on slower network connections, when you open a related item in the drawer, some of the flexible editor fields (especially ones with related nodes), fail to render the content. This a significant problem because if a user saves the changes, it sets the field that field to render to null.

Reproduction steps

  1. Create a new collection
  2. Add a flexible editor field with relational nodes
  3. Add a M2O relational field to the same collection
  4. Create 2 new items in this collection with content in the flexible editor including a relational node and add a relationship from the first item to the second
  5. Open the first item, and click the 'edit' button on the related item to open the second item in the drawer
  6. Your flexible editors should all load and render the content
  7. Now close the drawer and throttle your network connection (e.g. using chrome dev tools throttle to 'slow 3G')
  8. Now click the 'edit' button on the related item to open the second item in the drawer
  9. This time the flexible editor likely failed to render the content

Video proof

Github limit is 10MB, so this is a very quick video showing the issue.

https://github.com/formfcw/directus-extension-flexible-editor/assets/34007858/d128ddbd-3d67-4ef3-a709-09c5d1a0b8b2

formfcw commented 1 year ago

Does it work with v1.1.0?

jdjoshuadavison commented 1 year ago

We tested the below versions. There appears to have been a change with how Directus renders fields in the drawer with version 10.5.0. There's a visible difference to how all fields load in the drawer from 10.5.0, but Flexible Editor fields are the only ones that aren't working.

Flexible Editor 1.1.3

Directus 10.7.0-beta.0 ❌ Directus 10.6.1 ❌ Directus 10.6.0 ❌ Directus 10.5.0 ❌ Directus 10.4.3 ✅

Flexible Editor 1.1.0

Directus 10.6.1 ❌

formfcw commented 1 year ago

Fixed with v1.1.5

jdjoshuadavison commented 1 year ago

Really appreciate your speed on this one! Thanks.