-
Notifications
You must be signed in to change notification settings - Fork 15
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
CMS 5.2.0-beta1. Regression test: LinkField has "Draft / Modified" label even when Elemental Block was published #256
Comments
There is the similar problem for another nested versioned DataObject. Update: Related issue was open silverstripe/silverstripe-asset-admin#1450 |
@sabina-talipova I've closed the linked PRs because I don't think they're going about solving this the correct way. It's doing a couple of things I dislike:
Instead what I think we want to do is force the inline form (created using FormBuilder which uses redux-form) to refresh after a successful publish/unpublish so that linkfield will subsequently refresh its own data from the server. This is non-trivial and has a pretty frustrating learning curve so feel free to move this issue back into the ready column if you don't want to tackle it |
I put this ticket back to Ready column before blocking issue won't be merged. |
When publishing the block, the linkfield component does get re-rendered, but because its value hasn't changed and it isn't being updated via the modal (which would update the I can think of a few ways to resolve this, but none of them feel particularly elegant.
I don't really like any of these but I lean towards option 3. There's a hidden option 5 which is just do nothing. Refreshing the page or opening and closing a link modal refreshes its state so it's not wrong forever - only until further action is taken to update its display. I don't like this hidden option either though. |
I don't think 3 is viable if using context because you'd need to create something like Redux is more doable, though you'd still end up looking for elemental keys within linkfield. Redux is a pretty confusing beast and I'm prefer to not use it here, especially since it's not used at all for LinkField 2 actually seems like the most viable, though I don't really like it. Seems like we creating some sort of quasi global API that will probably only get implemented for this one niche use case |
The context idea would naturally rely on a context high enough up the chain that anything that needs to deal with it can deal with it. Both that and the redux idea would use something that isn't specific to elemental. |
@maxime-rainville can you please weigh in? This one may be worth leaving as is for now given it's not as simple as it first seemed. |
I think the fundamental problem here is that there's not a clean way of invalidating Basically, you want to detect a state change in You can achieve this in a somewhat hackish way by passing some dummy GET parameters in the schema URL that reflect the versioned state of the block. This commit illustrates what that might look like: silverstripe/silverstripe-elemental@7cbde1e This is what it looks like. I'm thinking the proper way to do this would be to add an extra prop to |
Oh yeah, I didn't consider re rendering the whole form. It's a trade off of slightly bad UX waiting for the form to reload (which isn't needed for 90% of the time) vs worse bad UX of temporarily displaying incorrect information in the remaining 10% of the time. I've got no problem making that tradeoff, I'll go that route. |
While there is a trade off, I suspect this is not the only place where this bug might occur. (e.g: Publishing a block auto-publish a file). |
Description
Executed on: SC PHP 8.3 Chrome LinkField
Test scenario: https://studio.cucumber.io/projects/301855/test-runs/947336/folder-snapshots/11144442/scenario-snapshots/34759621/test-snapshots/46444047
After publishing block draft label won't go away, but it has been published on the front end. when the page refreshes only it will go away.
Steps to reproduce issue:
Acceptance criteria
PR
The text was updated successfully, but these errors were encountered: