Skip to content

Conversation

westonruter
Copy link
Member

@westonruter westonruter commented Aug 9, 2025

Summary

Fixes #1239

When activating the plugin for the first time, a simple generic admin pointer message is displayed about all the features and how they can be activated:

Before After
image Screenshot 2025-08-09 at 16 39 46

If someone has the plugin already active (and previously dismissed this perflab-admin-pointer pointer, then when other PerfLab pointers have not already been dismissed, then they'll appear in a new admin pointer:

Screenshot 2025-08-09 at 16 40 45

Two feature-specific admin pointers are introduced, one for the new View Transitions plugin and another for the new logged-in opt-in for the Speculative Loading plugin.

The logic for adding the admin pointer was also refactored, making use of inline scripts. This eliminated the need for the perflab_render_pointer() function.

This PR also includes an Upgrade Notice for Performance Lab to also promote the View Transitions plugin, which was done previously for Image Prioritizer.

@westonruter westonruter added this to the performance-lab n.e.x.t milestone Aug 9, 2025
@westonruter westonruter added the [Type] Enhancement A suggestion for improvement of an existing feature label Aug 9, 2025
@westonruter westonruter added the [Plugin] Performance Lab Issue relates to work in the Performance Lab Plugin only label Aug 9, 2025
@westonruter westonruter requested a review from felixarntz as a code owner August 9, 2025 23:47
Copy link

github-actions bot commented Aug 9, 2025

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: westonruter <[email protected]>
Co-authored-by: felixarntz <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@westonruter westonruter requested review from felixarntz and removed request for felixarntz August 9, 2025 23:48
Copy link

codecov bot commented Aug 9, 2025

Codecov Report

❌ Patch coverage is 93.54839% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.58%. Comparing base (42bb977) to head (511d71e).
⚠️ Report is 12 commits behind head on trunk.

Files with missing lines Patch % Lines
plugins/performance-lab/includes/admin/load.php 93.54% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            trunk    #2122      +/-   ##
==========================================
+ Coverage   67.22%   67.58%   +0.36%     
==========================================
  Files          93       93              
  Lines        7758     7799      +41     
==========================================
+ Hits         5215     5271      +56     
+ Misses       2543     2528      -15     
Flag Coverage Δ
multisite 67.58% <93.54%> (+0.36%) ⬆️
single 36.44% <11.29%> (-0.27%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment on lines +89 to +118
/**
* @covers ::perflab_get_dismissed_admin_pointer_ids
*/
public function test_perflab_get_dismissed_admin_pointer_ids(): void {
$user_id = self::factory()->user->create( array( 'role' => 'administrator' ) );
wp_set_current_user( $user_id );

// No dismissed pointers.
$this->assertSame( array(), perflab_get_dismissed_admin_pointer_ids() );

// Dismiss a single pointer.
update_user_meta( $user_id, 'dismissed_wp_pointers', 'perflab-admin-pointer' );
$this->assertSame( array( 'perflab-admin-pointer' ), perflab_get_dismissed_admin_pointer_ids() );

// Dismiss multiple pointers.
update_user_meta( $user_id, 'dismissed_wp_pointers', 'perflab-admin-pointer,another-pointer' );
$this->assertSame( array( 'perflab-admin-pointer', 'another-pointer' ), perflab_get_dismissed_admin_pointer_ids() );

// Dismiss all pointers.
update_user_meta( $user_id, 'dismissed_wp_pointers', implode( ',', array_keys( perflab_get_admin_pointers() ) ) );
$this->assertSame( array_keys( perflab_get_admin_pointers() ), perflab_get_dismissed_admin_pointer_ids() );
}

/**
* @covers ::perflab_get_admin_pointers
*/
public function test_perflab_get_admin_pointers(): void {
$pointers = perflab_get_admin_pointers();
$this->assertArrayHasKey( 'perflab-admin-pointer', $pointers );
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Note: I'm happy to say that Gemini Code Assist was actually able to write most of this for me. In PhpStorm, I just did Cmd+\ and then entered /generate test perflab_get_dismissed_admin_pointer_ids and then again for perflab_get_admin_pointers(), and voilà!

Copy link
Member

@felixarntz felixarntz left a comment

Choose a reason for hiding this comment

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

@westonruter This is awesome, I really like the way you solved this with a single implementation that can handle separate pointer IDs per feature in a single pointer UI. 🎉

A few minor points of feedback, but it's almost good to go.

@westonruter westonruter requested a review from felixarntz August 11, 2025 18:07
Copy link
Member

@felixarntz felixarntz left a comment

Choose a reason for hiding this comment

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

@westonruter LGTM! Looking forward to seeing this launch.

@westonruter westonruter merged commit 32bc144 into trunk Aug 11, 2025
17 of 21 checks passed
@westonruter westonruter deleted the add/new-feature-admin-pointer branch August 11, 2025 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Plugin] Performance Lab Issue relates to work in the Performance Lab Plugin only [Type] Enhancement A suggestion for improvement of an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Promote new features when they are added to the plugin
2 participants