Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Problem/Motivation
As of 2432c02138861423b7db36526554afcacee0bc46 at least.
Steps to reproduce.
- Navigate to an article.
- Enable quick edit.
- Activate the body field and change the text.
- Save the changes.
- Open the contextual links on the entity and note that three quick edit links are now present.
Proposed resolution
unknown.
API changes
none.
Comments
Comment #1
jessebeach CreditAttribution: jessebeach commentedadding tags.
Comment #2
jessebeach CreditAttribution: jessebeach commentedAn illustration of the issue.
Comment #3
Wim LeersHrm. A new
ContextualLinkView
must be instantiated whenever a modified field is inserted… This should be pretty easy to fix :)If I work on fixing this now, I fear that will conflict with #1678002: Edit should provide a usable entity-level toolbar for saving fields? Let's fix this after that.
Comment #4
Wim LeersIt seems #1678002: Edit should provide a usable entity-level toolbar for saving fields has indirectly solved this! :)
Comment #5
TechNikh CreditAttribution: TechNikh commentedI can reproduce. screenshot is attached.
Comment #6
Wim Leers#5: Could you then please provide steps to reproduce? :)
Comment #7
jessebeach CreditAttribution: jessebeach commentedDefinitely, any tips to reproduce it will help us track down the conditions for the bug!
Comment #8
jessebeach CreditAttribution: jessebeach commentedadding a sprint tag.
Comment #9
jessebeach CreditAttribution: jessebeach commentedLooking into this...
Comment #10
TechNikh CreditAttribution: TechNikh commentedhttp://drupal8.drool4drupal.com/drupal/node/1 shows quick edit in contextual links twice.
http://drupal8.drool4drupal.com/drupal/node/49 shows only once
I don't know how these node are different from each other
I am guessing, it will be fixed if I clear cache.
for testing, I have given anonymous user access to edit nodes on my server.
Comment #11
jessebeach CreditAttribution: jessebeach commentedI bet this is related. We have a contextual link trigger without any contextual links.
Comment #12
jessebeach CreditAttribution: jessebeach commentedI added #2049601: Contextual links present an empty links trigger when no link items are available for an entity to deal with the empty contextual links, but I wasn't able to reproduce that issue today, so that side issue is postponed pending more input.
For the duplicated and triplicated "quick edit" links, the solution ended up being quite simple. We have a callback that inserts the quick edit link into the contextual links after a trip to server to get metadata about the link's entity and fields. The response to that request contains one or more insert commands for injecting JS data onto the page. The callback to insert the contextual link is invoked within the success callback to the AJAX request for metadata. If more than one insert command is returned, we get N quick links, where N equals the number of insert commands.
To fix this, I wrapped the contextual link insert callback in underscores
_.once()
utility. It creates a function wrapper that can only be invoked once. All subsequent calls are no-op. So we get exactly one links now per entity.Steps to reproduce
@TechNikh, can you verify the resolution?
Comment #13
TechNikh CreditAttribution: TechNikh commentedThanks jessebeach. I applied the above patch and http://drupal8.drool4drupal.com/drupal/index.php/node/1 shows quick edit link once.
Comment #14
TechNikh CreditAttribution: TechNikh commentedchanging status for automatic tests.
Comment #15
Wim LeersI wanted to review this patch and hopefully RTBC it, but it seems I can no longer reproduce the problem. I followed the steps to reproduce in the issue summary.
Can anybody else still reproduce it? If so, please update the steps to reproduce.
Comment #16
jessebeach CreditAttribution: jessebeach commentedUgh, now I can't reproduce it either. Not good. Not good. I don't like when things change and resolve without direct intervention. I'm marking this issue as postponed. I'm not yet convinced that this issue won't resurface.
Comment #17
Wim LeersA month later, zero such reports, and zero times been able to reproduce it. So: closing :)
Comment #18
Wim LeersSame issue has popped up again, now reliably reproducible: #2089397: Double "Quick edit" contextual link.
swentel has taken the patch in #12 and moved it over there. It still fixes the problem :)
I RTBC'd the patch there.