Unchecking "Applies to administration pages" in the settings screen updates the breadcrumb correctly. However, rechecking the option does not bring the updated breadcrumb back!

To test:

Load the EB setting screen.
Uncheck "Applies to administration pages"
Save the form.
The title Easy breadcrumb disappears from the screen.
Re check the option and save.
The title does NOT reappear and it should.
Clear cache, the title re-appears.

This threw me off when testing the last issue. I manually checked other EB config options and they work as expected. So, something is funky with caching and this one setting.

CommentFileSizeAuthor
#18 3619809 after.png388.12 KBcsakiistvan
#18 3619809 before.png77.78 KBcsakiistvan
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

greg boggs created an issue. See original summary.

greg boggs’s picture

I tested that the test failed before changing the code. Then, I added the config cache context, and tested passed. I then checked manually in Drupal and confirmed that toggling the admin route setting on and off makes the breadcrumbs change on and off.

Disclosure: AI was used to help me figure out why this is a bug, and to write the Test.

greg boggs’s picture

Status: Active » Needs review
loopduplicate’s picture

Assigned: Unassigned » loopduplicate

loopduplicate’s picture

Assigned: loopduplicate » Unassigned
Status: Needs review » Needs work

Shoot, the error is the same as the one on my local:

1) Drupal\Tests\easy_breadcrumb\Functional\EasyBreadcrumbAdminRouteToggleTest::testReEnablingAdminRoutesRestoresBreadcrumb
Exception: User warning: Trying to overwrite a cache redirect for "entity_view:block:breadcrumb:[languages]=en:[route]=system.admin35786c7117b4e38d0f169239752ce71158266ae2f6e4aa230fbbb87bd699c0e3:[theme]=stark:[user.permissions]=is-admin" with one that has nothing in common, old one at address "languages:language_interface, theme, user.permissions, route, languages" was pointing to "url.path.parent, url.path.is_front", new one points to "url".

Unassigning from myself to hear from Greg on his thoughts for next steps.

loopduplicate changed the visibility of the branch 3619809-re-checking-applies-to to hidden.

loopduplicate’s picture

Status: Needs work » Needs review
Issue tags: +cache

I hooked into the configuration save event to invalidate a custom tag that is added in the applies() method when the configuration for applying to admin routes is disabled.

loopduplicate’s picture

Assigned: Unassigned » loopduplicate
Status: Needs review » Needs work

User warning: Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "cache_context.easy_breadcrumb". in

This happens when you disable the admin crumbs and view a page

loopduplicate’s picture

Assigned: loopduplicate » Unassigned

Oof, this is a real doozy. I'll have to come back to it. Or maybe someone else can figure it out.

loopduplicate’s picture

Assigned: Unassigned » loopduplicate

loopduplicate changed the visibility of the branch 3619809-re-checking-applies-to-6 to hidden.

loopduplicate’s picture

Assigned: loopduplicate » Unassigned
Status: Needs work » Needs review

What I've done this time is:

Added a cache context and an event subscriber for config save.

In the applies() method, I add the cache context.

In the context subscriber, using the same logic for checking the "applies to admin paths" config and for checking to see if the current request is an admin path as is in the applies() method, I return a particular tag.

Then, in the config save event subscriber, the tag is invalidated.

loopduplicate’s picture

Fresh brain, new day. Turns out we don't need a subscriber. The context plugin is all that's needed.

csakiistvan’s picture

Status: Needs review » Reviewed & tested by the community

✅ Tested and works — MR !231. The fresh-brain call in was right: the context plugin on its own is enough, no config-save subscriber needed, and none of the earlier symptoms come back — no cache-redirect warning, and no missing cache_context.easy_breadcrumb service when admin crumbs are disabled.

csakiistvan’s picture

StatusFileSize
new77.78 KB
new388.12 KB
greg boggs’s picture

I tested this manually in tug boat, it works perfectly and I love having our own cache context to use for any future cache issues!

RTBC ++

loopduplicate’s picture

Assigned: Unassigned » loopduplicate

OMG, yes, Greg. That's how I feel too. Thanks also @csakiistvan. I'll work on merging this in now.

  • loopduplicate committed 32a50c25 on 2.x
    fix: #3619809 Re-checking "Applies to administration pages" in the...
csakiistvan’s picture

Nice to work with you guys <3

loopduplicate’s picture

Assigned: loopduplicate » Unassigned
Status: Reviewed & tested by the community » Fixed

you too, csakiistvan. Community is so important

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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