Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hey Spicy!
Craft 3.4 is adding support for delta element updates, meaning that entry, category, and user forms will only submit custom field values that actually changed, giving the back end a chance to optimize the element save process by avoiding saving things that haven’t changed.
Matrix already supports it, and we hope that Neo and Super Table will add support soon as part of a feature branch so people can start testing ahead of the 3.4.0 release.
I started working on adding Neo support for you, but hit a roadblock because the field is built by JavaScript, and I couldn’t find the JS source files in the repo. I’m hoping that you can take over from here.
Here’s what’s needed to add full delta update support to Neo:
Field::afterElementPropagate()
if the field isn’t dirtyField::_createBlocksFromSerializedData()
, and if used, stitch POSTed block data with existing block data, keeping track of which blocks are dirty[blocks]
sub-namespace (e.g.fields[myNeo][blocks][22][fields][myText]
rather thanfields[myNeo][22][fields][myText]
)name="fields[myNeo][sortOrder][]" value="<block ID>"
so that entire blocks don’t need to be resaved if only their position changes.myNeo[blocks][22]
), so that element forms know to group their nested inputs togetherregisterDeltas: true
when rendering either_includes/fields.html
or_includes/field.html
so that sub-fields get their own delta names as well.Fields::saveValue()
should start only saving blocks that were marked as dirty byField::_createBlocksFromSerializedData()
.See the diff at craftcms/cms#5146 to see how Matrix was affected by this.
To get Craft 3.4 running locally, change your
craftcms/cms
requirement incomposer.json
to:Then run
composer update
.Let me know if you have any questions!