Closed (fixed)
Project:
Autosave Form
Version:
8.x-1.0
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
16 Jan 2020 at 14:44 UTC
Updated:
7 Jul 2024 at 11:09 UTC
Jump to comment: Most recent
Calling ajax request to save draft on node delete page, I don't understand what do we save on the node delete (/node/%/delete) page, there won't be any changes, but still it's sending ajax requests to save content. Could you please clarify ?
I have just installed this module 8.x-1.0 through composer and tested manually, it's working only the node edit page, but not on the new node.
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
hchonovIt is a generic module and and is enabled on every form and the delete form is a regular entity form and therefore autosave is enabled there as well. In order to prevent it running on delete forms you could retrieve the form operation in
\Drupal\autosave_form\Form\AutosaveEntityFormHandler::isAutosaveEnabled()through\Drupal\Core\Entity\EntityForm::getOperation()and return FALSE if it is the delete operation or if the form object class extends from\Drupal\Core\Entity\ContentEntityDeleteForm. However I am curious how did you notice this? Did you had any side effects by having autosave on the delete form?There is an issue for this in the issue queue - #2924006: Autosave not working on content creation.
Comment #3
reddyweb commentedThanks much for the quick reply.
I didn't notice any side effects, but was keep getting "saving draft" message while am trying to delete the content, so I was just wondering why we're saving on delete. However based on your instructions above, we will customize and will avoid saving content on delete operation because business authors definitely will raise this concern.
Comment #4
hchonovCould you submit a patch please?
Comment #5
reddyweb commentedSure thing, I'm working on it, and will share it once it's done.
Comment #8
s_leu commentedCreated that patch/MR that was a sure thing 2 years ago ;)
Comment #9
dieterholvoet commentedWe can simplify the current solution:
ContentEntityDeleteFormimplementsEntityFormInterface, so that check is not necessary.$form_objectwill always be an instance ofEntityFormInterface, this is an assumption we can make so we don't need theinstanceofcheckI'll rebase and commit to the MR.
Comment #10
dieterholvoet commentedComment #11
mglamanComment #12
hchonovMerged. Thank you. This will be part of the 1.6 release.
Comment #13
hchonov