Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Using Classy as an example theme, when I load a page with a dropbutton the JS and CSS is not loaded:
When I rebuild the cache, the dropbuttons appear on the subsequent page load:
Proposed resolution
Investigate
Remaining tasks
Investigate
User interface changes
Fixed dropbutton
API changes
None
Data model changes
None
Comment | File | Size | Author |
---|---|---|---|
#17 | interdiff.txt | 1.27 KB | lauriii |
#17 | dropbutton_library_is-2544162-17.patch | 2.64 KB | lauriii |
#13 | dropbutton_library_is-2544162-13.patch | 2.27 KB | StryKaizer |
#13 | TEST-ONLY-SHOULD-FAIL_dropbutton_library_is-2544162-13.patch | 1.06 KB | StryKaizer |
#8 | 2544162-7.patch | 1.34 KB | Wim Leers |
Comments
Comment #1
willzyx CreditAttribution: willzyx commentedThis happens even using bartik and I think that happens with any theme..
The problems seems to be in views + render cache; if you disable the render cache (using cache.backend.null) or you disable the views module, dropbutton.js is attached to the page and dropbuttons are displayed properly. Not totally sure but the problem seems to be how views renders fields in FieldPluginBase::advancedRender()
Comment #2
jcnventura CreditAttribution: jcnventura at Wunder commentedOn my tests, this only happenned on /admin/content
Comment #3
willzyx CreditAttribution: willzyx commentedalso /admin/people is affected. I think that every page generated by views in which there are dropbuttons is affected
Comment #4
LewisNymanhmm yeah the dropbuttons on the node creation page are still rendering so this could be a views issue.
Comment #5
willzyx CreditAttribution: willzyx commentedmoving to views.module component
Comment #6
olli CreditAttribution: olli commentedComment #7
dawehnerWe seriously need a test for that, but maybe more important, get a more sane architecture in place for things which are renderer maybe or maybe not inside a render context.
You should be able to write APIs which can be used outside of a render context, otherwise all your render related APIs will be bound in its usage to render API, not just internally,
and this is IMHO horrible on the longrun for maintainability.
Comment #8
Wim LeersThis regression was introduced by #2511472: Refactor all usages of drupal_render()/Renderer::render() that break #2450993. That, in turn, was a spin-off/child issue of #2450993, and at #2450993-33: Rendered Cache Metadata created during the main controller request gets lost, the change to
StylePluginBase
that causes this problem was introduced.The root cause:
StylePluginBase
needs to be string-based.StylePluginBase
needs to userender()
, and notrenderPlain()
. This used to be the case until #2511472: Refactor all usages of drupal_render()/Renderer::render() that break #2450993. (Clearly we're missing some test coverage there.)renderPlain()
back torender()
. This will bubble onto the main rendering context.render()
will cause exceptions.RendererInterface::hasRenderContext()
method. Which we can now handily exploit to use eitherrender()
orrenderPlain()
.Yes, this is horrendous. But given the facts (Views' render pipeline was not updated in Drupal 8 to be render array-based, nor do render arrays support any format other than HTML, we have
hasRenderContext()
because of deficiencies in the URL generation APIs), this seems like a fair compromise. Views is likely the only piece of code that needs to ever do this.Comment #9
Wim LeersAgreed that these are important goals. We won't achieve them in 8.0.0. We must achieve them in 9.0.0. We should starting to achieve them in 8.x.0.
Comment #10
gints.erglis CreditAttribution: gints.erglis commented#8 patch can be applied and fix issue
Comment #11
jcnventura CreditAttribution: jcnventura at Wunder commentedConflict between RTBC and 'Needs tests'
Comment #12
StryKaizerWorking on a test
Comment #13
StryKaizerTest only + test & patch added
Comment #16
jcnventura CreditAttribution: jcnventura at Wunder commentedNice test! I've also reviewed the patch, so I'm restoring it to RTBC.
Let's get this in asap. We shouldn't ship RC1 without this.
Comment #17
lauriiiJust added some docs because otherwise no one will remember why this test is being done.
Comment #18
alexpottCommitted decb9b1 and pushed to 8.0.x. Thanks!