silverstripe / silverstripe-elemental

Create pages in Silverstripe CMS using content blocks
http://dna.co.nz
BSD 3-Clause "New" or "Revised" License
109 stars 115 forks source link

FIX Reload element form when element version changes #1200

Closed GuySartorelli closed 3 months ago

GuySartorelli commented 3 months ago

Requires https://github.com/silverstripe/silverstripe-admin/pull/1771 to actually fix the bug - but this PR is safe on its own as a patch as seen by CI going green. If the prop isn't used on the other end (i.e. if someone only updates elemental and not admin) then the bug will still be there, but it won't cause any new problems.

The form will be reloaded when the element is saved/published/unpublished, etc - but only if its version or versioned-state is changing.

Issue

GuySartorelli commented 3 months ago

Note to self: FOUT is "Flash Of Unstyled Text" (or in this case just flash of badness)

emteknetnz commented 3 months ago

A couple of potential ideas for CMS 6 which approach the problem by just not allowing inline publishing:

  1. Remove the inline publish/unpublish buttons. It's worth noting that there have been cases of people being frustrated that they cannot remove the publish button which has been a source of confusion to end users
  2. Change the inline edit form to a modal, similar to linkfield. This means there would be no publish button and you need to publish the parent (page) to publish the block. Might be issues with scrolling the modal though for blocks with lots of fields.

1's easier and 2's a stretch though if we got scrolling working it would standardise how we 'inline edit' DataObject's and we could do away with a bunch of elemental code thus reducing the maintenance surface

maxime-rainville commented 3 months ago

Given that we've received pretty clear indications that allowing publication of individual blocks is not ideal and that we have a card for CMS 6 to remove this action, I'm inclined to agree that fixing this specific bug is not a great use of time.

I think it's worth noting that it's not only LinkField that is affected by this. The UploadField has the same problem. Any relational field you might want to put in an Elemental block will have the same problem.

On the FOUT point, there's a pretty straight forward fix to this problem: don't nuke the current form state right away when the form builder gets invalidated ... instead wait until you get your form schema back. That should provide a nice smooth UI transition between the two state.

GuySartorelli commented 3 months ago

I took one look at trying that and while it is conceptually a simple idea, it is not simple to implement. I'm going to say this just isn't worth our time right now.