Skip to content
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

Use AJAX for activating features / plugins in Performance Lab #1583

Open
felixarntz opened this issue Oct 8, 2024 · 0 comments
Open

Use AJAX for activating features / plugins in Performance Lab #1583

felixarntz opened this issue Oct 8, 2024 · 0 comments
Labels
Good First Issue Issue particularly suitable to be worked on by new contributors Needs Dev Anything that requires development (e.g. a pull request) [Plugin] Performance Lab Issue relates to work in the Performance Lab Plugin only [Type] Enhancement A suggestion for improvement of an existing feature

Comments

@felixarntz
Copy link
Member

Feature Description

This is part of the improving the onboarding experience for Performance Lab (#1032).

A problem today is that activating a feature causes a full page reload. This makes it tedious to quickly activate multiple features, since you can't activate multiple at a time. It can even lead to errors, if users manage to click another feature activation button before the page reloads due to already having clicked another one.

We should implement the feature activation logic in a WP AJAX handler callback and adjust the JavaScript logic to use that.

Technical notes

  • The AJAX callback should use the perflab_install_and_activate_plugin() function, which already has this logic abstracted away from the concrete technical use-case.
  • The existing admin_action_* callback should remain in place, and the buttons should still link to the relevant URL, as it allows the functionality to still work, should the administrator have JavaScript disabled or in case there is a bug in the JavaScript code.
    • While this is not very crucial to support in today's time, there's very little overhead in maintaining the extra code, particularly because the bulk of the logic is already abstracted away to be reusable via perflab_install_and_activate_plugin().
  • In other words: The AJAX based activation should be implemented as a progressive enhancement.
@felixarntz felixarntz added [Plugin] Performance Lab Issue relates to work in the Performance Lab Plugin only [Type] Enhancement A suggestion for improvement of an existing feature Good First Issue Issue particularly suitable to be worked on by new contributors Needs Dev Anything that requires development (e.g. a pull request) labels Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good First Issue Issue particularly suitable to be worked on by new contributors Needs Dev Anything that requires development (e.g. a pull request) [Plugin] Performance Lab Issue relates to work in the Performance Lab Plugin only [Type] Enhancement A suggestion for improvement of an existing feature
Projects
Status: To Do 🔧
Development

No branches or pull requests

1 participant