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
When you login, the toolbar-icon appears at the top right corner of the screen. When you reload the page however, this toolbar-icon has now disappeared. I added screenshots to demonstrate this bug.
On the first login, the toolbar-icon appears at the top right corner. This is the result we would expect.
Source:
When reloading the page, this toolbar icon has now disappeared. We would expect the toolbar-icon to be visible on the exact same location.
Source:
Proposed resolution
TBD.
Remaining tasks
TBD.
User interface changes
Show the icon on a page reload.
API changes
None.
Comment | File | Size | Author |
---|---|---|---|
#8 | core-js-contextual-toolbar-client-cache-2181527-8.patch | 1.93 KB | nod_ |
toolbar-hidden-on-reload.png | 47.35 KB | sqndr | |
toolbar-not-hidden.png | 50.8 KB | sqndr | |
page-reload-no-toolbar.png | 289.14 KB | sqndr | |
toolbar.png | 291.99 KB | sqndr |
Comments
Comment #1
Wim LeersThis is a very subtle regression introduced by #2136507: Use client-side cache tags & caching to eliminate 1 HTTP requests/page for rendering Contextual Links (which landed just a few days ago). Thank you for reporting it! :)
I've already done a first round of debugging. It's definitely caused by #2136507, because it works fine on the first page load (i.e. cold client-side cache), but is consistently broken on subsequent page loads (i.e. warm client-side cache).
The fun part: even when stepping through it with a debugger, everything works correctly! For some reason, the "collection add" event is not triggered, or at least
contextual.toolbar.js
' callback is not triggered.Comment #2
Wim LeersComment #3
Wim LeersComment #4
sqndr CreditAttribution: sqndr commentedThis patch seems to fix the described issue. I can reload the page and the pencil always appears at the top right corner.
I think it's best if someone with more experience about #2136507 or the contextual module reviews the technical part of the patch.
Comment #5
Wim LeersThanks for the review, sqndr! :) I agree, a JS person should also review the patch.
Comment #7
Wim Leers3: contextual_toolbar_toggle_client_side_cache-2181527-3.patch queued for re-testing.
Comment #8
nod_This is a reroll because the indentation standard changed for JavaScript files. No need for commit credit because of this reroll.
Comment #9
Wim Leers8: core-js-contextual-toolbar-client-cache-2181527-8.patch queued for re-testing.
Comment #10
jessebeach CreditAttribution: jessebeach commentedSo the fix is to move the searching of the DOM into the next evaluation cycle with
window.setTimeout
to give a chance for inserted nodes to write into the DOM before we go searching for them.Testing and verified that this patch restores the Edit pencil.
Comment #11
nod_I know, I know. Opened #2212283: Auto-format JS files.
Comment #12
webchickOh, rad! I've totally had this happen to me before, but had absolutely no idea why, and thought I was going crazy. Well, I am going crazy. ;) But at least not because of this bug. :D
Committed and pushed to 8.x. Thanks!
Comment #13
Wim LeersHaha Angie :)