You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With a form with File Upload Fields I'm seeing recursive write requests starting from the selected upload folder into its children (folders and files). For a form with a not-small child file system under the upload folder, adding a field / saving a form at the least results in a wait while the writeComponents does it thing.
Seeing this with elemental userforms module, but I don't think the module is to blame. Setting writeComponents to false, not true, at https://github.com/symbiote/silverstripe-gridfieldextensions/blob/4.0.0/src/GridFieldEditableColumns.php#L169 speeds things up.
This could be related to the discussion at #733 and the various issues linked to that.
Steps
Create a form
Add File Upload Fields, select a upload folder
Dump files in the upload folder
Save the form
Add a new field (of any type), save the form
Observe save result/time
Actual Results
Whenever the form is saved, the following happens:
GridFieldEditableColumns::handleSave() is called
For each item found, write is called with writeComponents param = true
The folder linked to the File Upload Field is written, results in a onAfterSkippedWrite
Folder::updateChildFilesystem is called
Each child write() is called (results in skipped writes)
Each child is validated via validate()
The form eventually saves, times out or fails validation on one of the fields/field relations
Expected results
When a form is saved, only the changed fields are saved and their components are not saved.
Add a new field, save, only that field is saved.
Change a field type, title, only that field is saved.
Reorder field, only changed fields are saved
The fix I think would be to only save the form and its changed fields, and not the field components. I don't know if that is going to cause any regressions. Someone may have tried that already but I can't see the point of writing/validating possibly hundreds of unchanged linked records when a form is saved.
Because each child has validate() called, any extension that might perform validation / onbeforewrite is hit. This can result in further issues / time spent depending on what the extension is doing.
I thought subclassing GridFieldEditableColumns and using that in the userforms module, but without writeComponents could be a way forward? It still saves every single field but that's better than current.
Thanks
James
The text was updated successfully, but these errors were encountered:
🤔 I didn't get the PR merged yet because of variable naming I haven't found time to re-address. I do still intend to.
That change coupled with this DataExtension (below) is what gets applied to UserDefinedForm in my project in order to circumvent the issue you're having.
Once the GridFieldExtensions module PR is merged the intention is to then also make this more permenant in the UserForms module, too.
The default of writing components in GridFieldEditableColumns causes the unexpected behaviour of writing/validating every file in the designated upload folder whenever the File Upload Field is saved in the grid field.
If we had a custom editable form field in a userform that linked to a Page record, would the Page record be written on every field save? Probably something that we wouldn't want to happen automatically.
Maybe a starting point is to find out if components of the editable fields need to be recursively written in the userform editable fields interface, or if it's just a result of the default in GridFieldEditableColumns ?
I don't think GridFieldEditableColumns should be writing components at all by default, feels like something a developer should turn on case-by-case basis. Changing it will cause BC issues, tho :(
Hi folks
With a form with File Upload Fields I'm seeing recursive write requests starting from the selected upload folder into its children (folders and files). For a form with a not-small child file system under the upload folder, adding a field / saving a form at the least results in a wait while the writeComponents does it thing.
Seeing this with elemental userforms module, but I don't think the module is to blame. Setting writeComponents to false, not true, at https://github.com/symbiote/silverstripe-gridfieldextensions/blob/4.0.0/src/GridFieldEditableColumns.php#L169 speeds things up.
This could be related to the discussion at #733 and the various issues linked to that.
Steps
Actual Results
Whenever the form is saved, the following happens:
Expected results
When a form is saved, only the changed fields are saved and their components are not saved.
The fix I think would be to only save the form and its changed fields, and not the field components. I don't know if that is going to cause any regressions. Someone may have tried that already but I can't see the point of writing/validating possibly hundreds of unchanged linked records when a form is saved.
Because each child has validate() called, any extension that might perform validation / onbeforewrite is hit. This can result in further issues / time spent depending on what the extension is doing.
I thought subclassing GridFieldEditableColumns and using that in the userforms module, but without writeComponents could be a way forward? It still saves every single field but that's better than current.
Thanks
James
The text was updated successfully, but these errors were encountered: