Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX Reload element form when element version changes #1200

Conversation

GuySartorelli
Copy link
Member

Requires silverstripe/silverstripe-admin#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

Comment on lines -9 to +10
published: PropTypes.bool,
liveVersion: PropTypes.bool,
isPublished: PropTypes.bool,
isLiveVersion: PropTypes.bool,
Copy link
Member Author

@GuySartorelli GuySartorelli May 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sort-of-unrelated refactoring - I noticed these were wrong when I tried to use the old keys but they kept showing undefined

The form will be reloaded when the element is
saved/published/unpublished, etc - but only if its version or
versioned-state is changing.
@GuySartorelli GuySartorelli force-pushed the pulls/5.2/reload-form-on-version-change branch from ee6a200 to e9776e4 Compare May 31, 2024 02:04
Copy link
Member

@emteknetnz emteknetnz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this method is viable unfortunately, with this PR there's now a massive FOUT that looks really bad that wan't there before. Given that LinkField's on elemental is a pretty niche use-case, and inline-publishing itself isn't broken, it's just got the incorrect label until the page is refreshed, I'd consider this new FOUT to be a regression

Also subsequent inline editing and publishing doesn't actually reload the block, so the original issue hasn't been fully fixed

I've provided a video of before and after https://www.youtube.com/watch?v=yNryWP-m0CY

I'd be inclined to just close this one as too hard because I think there needs to be a more advanced solution to resolve this.

Note that upload field has the same issue of incorreclty saying it's draft when it's published, however I don't think we've had many complaints about this so perhaps this isn't that big of a real world issue

@GuySartorelli
Copy link
Member Author

GuySartorelli commented Jun 4, 2024

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

@emteknetnz
Copy link
Member

emteknetnz commented Jun 4, 2024

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
Copy link
Contributor

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
Copy link
Member Author

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.

@GuySartorelli GuySartorelli deleted the pulls/5.2/reload-form-on-version-change branch June 5, 2024 02:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants