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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Wim Leers’s picture

Assigned: Unassigned » Wim Leers
Issue tags: +Spark, +sprint, +JavaScript

This 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.

Wim Leers’s picture

Title: Toolbar-icon doesn't appear on page reload » Contextual's toolbar toggle doesn't appear once the client-side cache is filled
Related issues: +#2136507: Use client-side cache tags & caching to eliminate 1 HTTP requests/page for rendering Contextual Links
Wim Leers’s picture

Status: Active » Needs review
FileSize
1.17 KB
sqndr’s picture

This 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.

Wim Leers’s picture

Thanks for the review, sqndr! :) I agree, a JS person should also review the patch.

Status: Needs review » Needs work

The last submitted patch, 3: contextual_toolbar_toggle_client_side_cache-2181527-3.patch, failed testing.

Wim Leers’s picture

Status: Needs work » Needs review
nod_’s picture

This is a reroll because the indentation standard changed for JavaScript files. No need for commit credit because of this reroll.

Wim Leers’s picture

jessebeach’s picture

Status: Needs review » Reviewed & tested by the community

So 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.

nod_’s picture

I know, I know. Opened #2212283: Auto-format JS files.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Oh, 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!

Wim Leers’s picture

Issue tags: -sprint

Haha Angie :)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.