fix: skip activity-stream assets on non-network admin dashboard#785
fix: skip activity-stream assets on non-network admin dashboard#785superdav42 merged 1 commit intomainfrom
Conversation
The enqueue_scripts() method only checked $pagenow === 'index.php', which matches both /wp-admin/index.php (per-site dashboard) and /wp-admin/network/index.php (network dashboard). The activity-stream Vue app and its #activity-stream-content mount point are only rendered on the network dashboard via wp_network_dashboard_setup, so loading the script on the per-site dashboard caused: [Vue warn]: Cannot find element: #activity-stream-content Add an is_network_admin() guard to bail early on the per-site dashboard.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe PR modifies Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Files Changed
Testing
Runtime TestingRisk level: Low — guard condition only, no logic change to the widget itself. Merged via PR #785 to main. aidevops.sh v3.6.235 spent 6m on this as a headless bash routine. |
🔨 Build Complete - Ready for Testing!📦 Download Build Artifact (Recommended)Download the zip build, upload to WordPress and test:
🌐 Test in WordPress Playground (Very Experimental)Click the link below to instantly test this PR in your browser - no installation needed! Login credentials: |
|
Performance Test Results Performance test results for 2aaea46 are in 🛎️! Note: the numbers in parentheses show the difference to the previous (baseline) test run. Differences below 2% or 0.5 in absolute values are not shown. URL:
|
…gets_Test Add 7 unit tests covering the template_selection → template_id validation mapping fix from PR #800: - template_selection required attribute maps to template_id rule key - min:1 guard rejects template_id=0 during checkout - positive template_id passes validation - no min:1 added when template_selection field is absent - template_id=0 allowed with base rule (admin/network context) - non-template required fields still map to themselves Fix Dashboard_Widgets_Test failure caused by PR #785 adding is_network_admin() guard to enqueue_scripts(). The test now uses set_current_screen('dashboard-network') to simulate the network admin context. Also adds a new test confirming the per-site dashboard does NOT enqueue wu-activity-stream.
…gets_Test (#801) Add 7 unit tests covering the template_selection → template_id validation mapping fix from PR #800: - template_selection required attribute maps to template_id rule key - min:1 guard rejects template_id=0 during checkout - positive template_id passes validation - no min:1 added when template_selection field is absent - template_id=0 allowed with base rule (admin/network context) - non-template required fields still map to themselves Fix Dashboard_Widgets_Test failure caused by PR #785 adding is_network_admin() guard to enqueue_scripts(). The test now uses set_current_screen('dashboard-network') to simulate the network admin context. Also adds a new test confirming the per-site dashboard does NOT enqueue wu-activity-stream.
Summary
enqueue_scripts()method inDashboard_Widgetsonly checked$pagenow === 'index.php', which matches both the per-site dashboard (/wp-admin/index.php) and the network dashboard (/wp-admin/network/index.php).#activity-stream-content) is only rendered on the network dashboard viawp_network_dashboard_setup. Loading the script on the per-site dashboard caused a JS console error:[Vue warn]: Cannot find element: #activity-stream-content.is_network_admin()guard inenqueue_scripts()to bail early when not on the network admin.Files Changed
inc/class-dashboard-widgets.php— addedis_network_admin()early-return guardTesting
/wp-admin/index.php(per-site dashboard): no Vue console error, activity-stream script not loaded./wp-admin/network/index.php(network dashboard): activity-stream widget loads and functions correctly.Runtime Testing
Risk level: Low — guard condition only, no logic change to the widget itself.
Verification:
self-assessed— the fix is a single conditional that prevents script enqueue on the wrong screen.Summary by CodeRabbit