-
Notifications
You must be signed in to change notification settings - Fork 125
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: Compatibility with versioned DataObjects #38
Comments
A benchmark is probably the only way to find out. |
Did this ever get looked at? |
Hey @MattyBalaam I don't think that this has been looked at (I certainly haven't I'm afraid). However there is this module (https://github.com/heyday/silverstripe-gridfieldversionedorderablerows), that I've used on a couple of projects, which might help. |
Thank you, I will investigate. |
(Andrew's assigned the module over as he's taking a back-seat in SS land for a while, hence the lack of attention to the issue). My understanding of the way the sort functionality is being triggered is to avoid (potentially) loading lots of data objects and triggering lots of ->write() calls when re-ordering items - given moving an item at the head of the list towards the back of the list triggers updates on all the items in-between. Now, if the current list being displayed is relatively small, that's not really a problem, but if you're displaying 100s at once, it might be; has someone got a sample implementation? It's probably something that could be done as a configurable option? |
The module above shows how it can be done, it is an extension to this. Moving objects is a slight fudge as any changes seem to go live immediately, rather than just to a draft. But, data objects have always seemed to work this way anyway. |
Yep, implementation wise there's no real issue, but there is the problem of which implementation approach should be taken, given the possible tradeoffs.
So there's two somewhat related implementation problems; is the sort update done using DB::query or ->write() (regardless of versioned status of the dataobjects being manipulated), and separately, should all items be immediately ->published() afterwards? I'm thinking that both could be solved with configurable settings when creating the GridField config - will take a look over the next few days (and see if there's some code I have from a client project that might help for a 'publish all changes' type of button). |
Any update on this? Especially now with SS4 taking an "everything Versioned" approach, this is a big issue... |
Just to pipe up here, we have tried https://github.com/heyday/silverstripe-gridfieldversionedorderablerows as mentioned by @nedmas and it works pretty well. The auto publishing is an issue though, I have to admit the only way I could see fix it might be to use a gridfieldcomponent that auto publishes it's list when the parent is published (rather than automatically publishing on change)? |
Just stumpled over this as well with SS4. Im not sure how the Draft state is triggered but i would welcome if the silverstripe-gridfieldversionedorderablerows module mentioned by @mlewis-everley would trigger this instead of a automatic publish. In the meantime i will try silverstripe-gridfieldversionedorderablerows. |
i think this was mostly solved with d1021ac No? |
fixed by #243 |
I’m not sure this is entirely resolved - this module will still only save draft versions when changing the sort order, there’s no way to automatically propagate that change to live. Use case example: a lumberjack GridField containing a lot of child pages - auto-publishing the children when the parent is written is really slow, as a bunch of changeset records are created I’d like to see this as an opt-in API, I wrote this extension of the existing |
As in #21 it would be great if the
GridFieldOrderableRows
supported versionedDataObjects
. So I thought it would be good to start a discussion regarding the best solution as I agree with @ajshort that coupling the components should be avoided.My suggestion is that the current implementation that uses
DB::query()
to update the sort order is replaced withDataObject::write()
. This would ensure that all the relevant pre/post write code gets run (including all the versioned related code).However I recognise that this will add a certain amount of overhead to re-ordering, is this acceptable or is there a more elegant solution?
The text was updated successfully, but these errors were encountered: