Skip to content

Fix/persist navigation tree cache#132

Closed
DannyCrews wants to merge 16 commits into
developfrom
fix/persist-navigation-tree-cache
Closed

Fix/persist navigation tree cache#132
DannyCrews wants to merge 16 commits into
developfrom
fix/persist-navigation-tree-cache

Conversation

@DannyCrews

Copy link
Copy Markdown
Member

No description provided.

DannyCrews and others added 16 commits August 31, 2021 17:00
use the rulesets in the repo instead
for markdownlint
because the readme.md has a lot of them, and I'd rather defer fixing them.
for cache busting as recommended by phpcs on codeclimate
per wp standards feedback in codeclimate
to be more specific, two letter parameter names are too short for the wp standards
as the only loaded library is really intrinsic still to this plugin
* MASTER into DEVELOP (#123)

* 📝 update readme with block description

* 🔖 version bump

to 1.3.4

* exclude build files from analysis

in codeclimate

* don't use external rulesets anymore

use the rulesets in the repo instead

* adjust readme spacing

for markdownlint

* ignore composer included files in codeclimate

* spacing fixes in readme

* disable markdown line length check

because the readme.md has a lot of them, and I'd rather defer fixing them.

* add version number to style enqueu

for cache busting as recommended by phpcs on codeclimate

* set in_footer parameter to true

per wp standards feedback in codeclimate

* change parameter name

to be more specific, two letter parameter names are too short for the wp standards

* don't exclude the composer loaded code yet

as the only loaded library is really intrinsic still to this plugin

---------

Co-authored-by: Dan Crews <DannyCrews@users.noreply.github.com>
Co-authored-by: Jonathan Williams <tamlin@mac.com>
Co-authored-by: Jonathan Williams <jdub233@users.noreply.github.com>

* Fix jquery depreciations

* Replace .bind with .on and .attr with .prop

* Replace .attr('checked') with .prop('checked')

* Minify files

* Version bump

---------

Co-authored-by: Tim King <112511000+timkingbu@users.noreply.github.com>
Co-authored-by: Dan Crews <DannyCrews@users.noreply.github.com>
Co-authored-by: Jonathan Williams <tamlin@mac.com>
Co-authored-by: Jonathan Williams <jdub233@users.noreply.github.com>
The 'bu-navigation' object cache group (the load_sections section/membership
structure) was registered non-persistent, so on production with an active
object cache the expensive GROUP_CONCAT/GROUP BY wp_posts scan re-ran on
nearly every front-end render under crawler concurrency.

Leave the group persistent (Redis-backed). This is safe by construction: the
cached payload is order- and status-independent parent/children membership
only, keyed on core's posts 'last_changed' value (bumped by clean_post_cache()
on every post insert/update/delete), so a stale entry is orphaned rather than
served. Publication status, menu_order ordering, and navigation meta are
applied downstream on the uncached get_nav_posts() query and are never served
from this cache.

Harden the cache entry with an explicit DAY_IN_SECONDS TTL backstop and a
site-scoped key (get_current_blog_id()) for multisite isolation, mirroring the
bu-calendar default-URL cache.

Bump version to 1.3.6; also corrects the VERSION constant, which had drifted
to 1.3.4 while the plugin header read 1.3.5.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates BU Navigation to make the navigation tree “sections” cache persist across requests (to avoid repeatedly running the expensive GROUP_CONCAT/GROUP BY hierarchy query), along with a set of jQuery modernizations and version/docs updates.

Changes:

  • Persist load_sections() results in the bu-navigation object-cache group with a version-stamped, site-scoped cache key and a 1-day TTL backstop.
  • Modernize several admin JS behaviors (e.g., delegate()on(), andSelf()addBack(), attr('checked')prop('checked')) and regenerate minified bundles.
  • Bump plugin/readme versions and update Code Climate excludes / markdownlint configuration.

Reviewed changes

Copilot reviewed 11 out of 14 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
composer-includes/bu-navigation-core-widget/src/data-model.php Makes load_sections() cache persistent with TTL and site-scoped keying.
bu-navigation.php Updates plugin version and removes non-persistent cache group registration.
src/block.php Minor cleanup and asset enqueue tweaks (script in footer, frontend CSS versioning).
js/bu-navigation.js jQuery compatibility updates (addBack, event binding changes).
js/bu-navigation.min.js Regenerated minified bundle reflecting js/bu-navigation.js changes.
js/navigation-metabox.js Uses prop('checked') and on() for events.
js/navigation-metabox.min.js Regenerated minified bundle reflecting js/navigation-metabox.js changes.
js/manage.js Uses prop('checked') for link target toggles.
js/manage.min.js Regenerated minified bundle reflecting js/manage.js changes.
composer-includes/bu-navigation-core-widget/templates/widget-form.php Uses prop('checked') for widget form logic.
readme.txt Stable tag bump + changelog entry; adds Navigation Block bullet.
readme.md Stable tag bump + changelog entry; markdown formatting improvements.
package.json Updates npm package version (currently not aligned with plugin/readme).
.codeclimate.yml Excludes build/ and disables markdown line-length check (MD013).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +94 to 97
$cache_key = 'all_sections:' . get_current_blog_id() . ':' . md5( serialize( $post_types ) . ":$last_changed" );
if ( $all_sections = wp_cache_get( $cache_key, 'bu-navigation' ) ) {
return $all_sections;
}
Comment thread package.json
Comment on lines 1 to 5
{
"name": "bu-navigation",
"version": "1.3.3",
"version": "1.3.5",
"description": "Provides alternative navigation elements designed for blogs with large page counts",
"main": "bu-navigation.php",
Comment thread readme.txt
* Replaces the built-in “Page Parent” and “Menu Order” dropdowns with an intuitive drag and drop interface for managing your page hierarchy
* The “Edit Order” screen presents you with a holistic view of your site’s structure for bulk ordering operations
* The Content Navigation widget presents a customizable sidebar navigation list fed from your natural page hierarchy
* The Navigation Block provides a navigation menu based on a customizeable parent post
Comment thread readme.md
Comment on lines +20 to +21
* The Navigation Block provides a navigation menu based on
a customizeable parent post
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants