Problem/Motivation
Since #2351015: URL generation does not bubble cache contexts autocomplete suggestions on entity reference fields don't work.
To reproduce, open the page for adding a new node and try to fill Authored by entity reference field (Authoring information tab).
There should be no suggestions based on the input.
When I manually access the data autocomplete path with the query, it works fine. JavaScript related issue?
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | autocomplete_is_broken-2536456-15.patch | 1.88 KB | mbovan |
| #15 | autocomplete_is_broken-2536456-15-interdiff.txt | 896 bytes | mbovan |
| #15 | autocomplete_is_broken-2536456-15-TEST-ONLY.patch | 896 bytes | mbovan |
| #8 | autocomplete-bubbleable-2536456-7.patch | 1 KB | berdir |
Comments
Comment #1
dawehnerI'm curious, do you have a HTTP query going on for the autocompletion or does it even not do that?
Comment #2
mbovan commentedI don't get a http query request...
Comment #3
dawehnerI'm pretty sure this would be solved with #2535118: Toolbar subtrees not working on admin pages due to lack of theme negotiation on Toolbar's custom JSONP route
Comment #4
wim leersYes, based on #3, I suspect the root cause is simply that a JS error occurred, and that no further JS executes.
To verify: please disable Toolbar module and test again.
Comment #5
mbovan commentedTried with uninstalling Toolbar, still doesn't work... It's the same when I apply patch #1 from #2535118: Toolbar subtrees not working on admin pages due to lack of theme negotiation on Toolbar's custom JSONP route
Comment #6
berdirThere are no JS errors.
Just go to node/add/article and try to use the author autocomplete.
No errors, no HTTP requests, no visual feedback. *Nothing* happens.
Which, isn't very surprising, considering that autocomplete.js. is. not. even. loaded :)
Comment #7
wim leersGiven this, I don't believe this could be related to #2535118: Toolbar subtrees not working on admin pages due to lack of theme negotiation on Toolbar's custom JSONP route at all.
EDIT: also: confirmed what Berdir said in manual testing.
Comment #8
berdirOk, found and fixed *two* bugs.
1) merge wasn't used properly. This didn't actually result in a visible bug.
2) the attachment was added to $element after creating $metadata from it and then re-applying it dropped it again.
This was definitely caused by the bubbleable links issue, because that switched to BubbleableMetadata, before it was just Cacheable, without #attachments.
Tests should be easy, just need to make sure that autocomplete.js is loaded.
Comment #9
wim leers+1 for every word in #8.
Comment #10
wim leersComment #11
alexpottThis has to be critical no? We could not ship Drupal 8 with this bug. Not being able to change the author of a node is a critical bug.
Comment #12
wim leers+1
Comment #13
catchHeh I was about to do the same thing but couldn't quite decide. Autocomplete not autocompleting is in the same category as page titles disappearing, so yes agreed on critical even if the bug itself is a straightforward one.
Comment #14
fabianx commentedCNW for tests, else RTBC
Comment #15
mbovan commentedAdded tests... Uploading a test only patch too.
Comment #16
wim leersComment #18
dawehnerI was wondering whether this is the right way to ensure that. Yes it works, but it will break once, for some probably valid reason, you enable js aggregation for tests as well
Comment #19
dawehnerWe agreed on IRC that this would be a follow up.
Comment #20
alexpottCommitted f678e37 and pushed to 8.0.x. Thanks!
We should add a test for this in a followup. From @Wim Leers in IRC:
Comment #22
tim.plunkettToo late for the commit message, but whatever :)
Comment #23
wim leersOops!
Comment #24
mbayntonJust hit this working on my 1st D8 site build, always nice when not only is the issue already written, but it's fixed too! Thanks @Berdir and @mbovan!
So a pretty satisfactory git pull from last 24 hours, overall :)