-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
USAGOV-1937-clear-menu-link: #1923
Conversation
906a3d5
to
5f436d7
Compare
…ink cache. Needed when running a Tome export to build page navigation correctly when more than one path is exported by a process.
5f436d7
to
5fa0b27
Compare
web/modules/custom/usagov_ssg_postprocessing/src/EventSubscriber/RequestPrepareSubscriber.php
Outdated
Show resolved
Hide resolved
…out why higher path count saves redirects as the original page instead of a meta refresh.
…V-1773-clear-menu-link
…een page requests to fix how redirects are exported.
…GOV-1773-clear-menu-link' into USAGOV-1773-clear-menu-link
… Spanish homepage URL that can be treated as a redirect by Tome
…ng node/nid paths.
…doesn't re-export pages as invoked paths when path_count is greater than 1.
…0 for tome static runs
…V-1773-clear-menu-link
…V-1773-clear-menu-link
@omerida I'm just reviewing things and I think this PR should be marked "draft" until you think it's good to go. So I did that. |
…V-1937-clear-menu-link
…che to the patch for the tome module.
Yeah, I noticed that. We have bin/drupal-update which does that plus a bit more and I did that. |
I found another cache that should be busted, for menu link content. I've updated the RequestPrepareSubscriber to reset it. I'm testing it now and will push the update shortly (waiting for one more tome run to finish) |
Glad to hear it! I realized today that I probably, um, moved the |
@akf Resetting the menu link content cache generates the same HTML but only if I run |
I found another cache to reset and pushed an update to bust it. Multiple runs still eventually start showing the wrong breadcrumbs, menu, or navigation cards on occasion. I'm going to move this back to draft and keep testing |
Found there's a cache related issue with menu_breacrumb module that has a patch. I've updated with the patch locally and am not running into random taxonomy datalayer / breadcrumb / nav card page weirdness when running tome. I've pushed that update here. On Monday I will do some more testing and (hopefully) can switch this away from draft. |
OK, it looks like the 'menu' entity manager needs to have its cache cleared between requests via Tome's subscriber. I've tested exports and I'm not seeing the random datalayer or navigation card pages after sequential exports. The process is 2x as fast with a path count of 10 versus 1. Going up to 20 didn't seem to make a big difference in my limited testing With path count = 1:
With path count = 10:
I also spoke to Dale and his PR for wizard datalayer issues addresses the duplicated rows I was seeing in published pages.csv. |
Just found that the export static asset pass also needs to track init_paths to prevent exporting the same path multiple times. I need re-roll the patch and test some more. |
…init paths to prevent exporting the same page more than once.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran one test on my local and it passed everything in your description except (sorry, there's an "except") ... there is a difference in the mobile menus on the agency index "letter" pages. It's just the agency index pages, both English and Spanish. But it does seem to be all of the agency index pages (21 English, 15 Spanish).
After doing the diff, I viewed my site as an anonymous user and I could see the incorrect menu, so I can give you a screen shot!
Here's what the text diff looks like for a single page.
diff -brwd --strip-trailing-cr --exclude=_data -I js-view-dom-id --exclude=themes tidy-html-dev/agency-index/b/index.html tidy-html-1773/agency-index/b/index.htm\
l
17,43c17,43
---
171c171
< <li class="navigation__item">
---
> <li class="navigation__item"><a href="/agency-index">A-Z index of U.S. government departments and agencies</a>
173,174d172
< <li class="navigation__item sibling"><a href="/buy-from-government">Buying from the U.S. government</a></li>
< <li class="navigation__item sibling"><a href="/facts-figures">U.S. facts and figures</a></li>
176,181d173
< <li class="navigation__item sibling"><a href="/state-local-governments">State and local governments</a></li>
< <li class="navigation__item sibling"><a href="/branches-of-government">Branches of government</a></li>
< <li class="navigation__item sibling"><a href="/elected-officials">Elected officials</a></li>
< <li class="navigation__item sibling"><a href="/laws-and-regulations">Federal laws and regulations</a></li>
< <li class="navigation__item sibling"><a href="/tribes">Indian tribes and resources for Native Americans</a></li>
< <li class="navigation__item sibling"><a href="/courts">Federal, state, territory, county, and municipal courts</a></li>
And here's a screen shot of a page showing what that looks like on a rendered (cms) page:
I am keenly aware that this might be hard to reproduce.
if ($changes) { | ||
// Render it as HTML5: | ||
$modifiedHtml = $html5->saveHTML($document); | ||
$event->setHtml($modifiedHtml); | ||
} | ||
} | ||
|
||
/** | ||
* Prevent exporting paths Tome might discover after the collect paths event. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, specifically "prevent exporting node-based paths" ...
This is probably a separate can of worms, but I look at this simple function and wonder whether it might not be a better approach than what we currently have for excludeDirectories? That is, go ahead and let the all the paths be collected, and then mark the ones that match our exclusion rules as invalid?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be somewhat faster if you don't have to load the node entities too, no? Though I bet those are cached already...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would expect it to be. I'm certain that when I wrote that, I didn't think there was a way to get at the path alias without loading the node entity.
We chatted about this in Jira |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It all checks out. The only differences I found were those darn agency index mobile menus, which we've agreed are a separate problem.
Jira Task
https://cm-jira.usa.gov/browse/USAGOV-1937
Description
Adds an event subscriber to clear menu link cache.
Needed when running a Tome export to build page navigation correctly when more than one path is exported by a process.
Type of Changes
Testing Instructions
Change Requirements
Validation Steps
find . -name '*.html' -type f -print -exec tidy -config ../tidy-config.txt --warn-proprietary-attributes false -mq '{}' \;
diff -brwd --strip-trailing-cr --exclude=_data -I js-view-dom-id --exclude=themes html-old/ html-new/ | grep -v sjpnwi | grep -v sjpja5 > html.diff
grep -r 'http-equiv=\"refresh\"' . | wc -l
Security Review
Reviewer Reminders
Post PR Approval Instructions
Follow these steps as soon as you merge the new changes.
Review in Test
and add a comment. State whether the change is already visible on cms-dev.usa.gov and beta-dev.usa.gov, or if the deployment is still in process.