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

Drop Select2 in Backwards compatable manner #48731

Open
wants to merge 4 commits into
base: trunk
Choose a base branch
from

Conversation

naman03malhotra
Copy link
Contributor

@naman03malhotra naman03malhotra commented Jun 21, 2024

Submission Review Guidelines:

Changes proposed in this Pull Request:

Closes #48577

Given that Select2 and SelectWoo have the same APIs, this PR points the registry of the Select2 library to SelectWoo.

How to test the changes in this Pull Request:

Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:

Please test it with the following instructions:

  • Open \wp-admin > advanced > Webhooks page
  • In wc-enchanced-select.js replace .selectWoo with .select2 every where in the file.
  • Refresh and clear browser cache if required.
  • Verify if the file is loaded with select2 by going to browser console > sources > cmd + p > search for wc-enhanced-select.js > verify if it has select2.
  • Select Dropdown should work as expected in \wp-admin > advanced > Webhooks page

image

Changelog entry

  • Automatically create a changelog entry from the details below.
  • This Pull Request does not require a changelog entry. (Comment required below)
Changelog Entry Details

Significance

  • Patch
  • Minor
  • Major

Type

  • Fix - Fixes an existing bug
  • Add - Adds functionality
  • Update - Update existing functionality
  • Dev - Development related task
  • Tweak - A minor adjustment to the codebase
  • Performance - Address performance issues
  • Enhancement - Improvement to existing functionality

Message

Changelog Entry Comment

Comment

@naman03malhotra naman03malhotra changed the title init Drop Select2 Jun 21, 2024
@github-actions github-actions bot added the plugin: woocommerce Issues related to the WooCommerce Core plugin. label Jun 21, 2024
Copy link
Contributor

github-actions bot commented Jun 21, 2024

Test using WordPress Playground

The changes in this pull request can be previewed and tested using a WordPress Playground instance.
WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Test this pull request with WordPress Playground.

Note that this URL is valid for 30 days from when this comment was last updated. You can update it by closing/reopening the PR or pushing a new commit.

Copy link
Contributor

github-actions bot commented Jun 21, 2024

Size Change: 0 B

Total Size: 2.5 MB

compressed-size-action

@naman03malhotra naman03malhotra changed the title Drop Select2 Drop Select2 in Backwards compat manner Jun 27, 2024
@naman03malhotra naman03malhotra added the focus: performance The issue/PR is related to performance. label Jun 27, 2024
@naman03malhotra naman03malhotra self-assigned this Jun 27, 2024
@naman03malhotra naman03malhotra marked this pull request as ready for review June 27, 2024 16:16
@naman03malhotra naman03malhotra changed the title Drop Select2 in Backwards compat manner Drop Select2 in Backwards compatable manner Jun 27, 2024
@naman03malhotra naman03malhotra requested review from a team and coreymckrill and removed request for a team June 27, 2024 16:18
Copy link
Contributor

github-actions bot commented Jun 27, 2024

Hi @jorgeatorres, @frosso, @coreymckrill, @claudiulodro,

Apart from reviewing the code changes, please make sure to review the testing instructions as well.

You can follow this guide to find out what good testing instructions should look like:
https://github.com/woocommerce/woocommerce/wiki/Writing-high-quality-testing-instructions

@naman03malhotra naman03malhotra requested review from jorgeatorres and coreymckrill and removed request for coreymckrill June 27, 2024 16:19
@naman03malhotra
Copy link
Contributor Author

Requested @jorgeatorres's review, and he already has some context on it.

@naman03malhotra naman03malhotra added the type: technical debt This issue/PR represents/solves the technical debt of the project. label Jun 27, 2024
Copy link
Member

@jorgeatorres jorgeatorres left a comment

Choose a reason for hiding this comment

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

Overall, this looks good to me @naman03malhotra. Thanks for working on this!

In the admin, we're still registering a select2 script, which we could also point to selectWoo. It should be safer to even remove it entirely, but I guess there might be extensions out there relying on this for whatever reason.

wp_register_script( 'select2', WC()->plugin_url() . '/assets/js/select2/select2.full' . $suffix . '.js', array( 'jquery' ), '4.0.3' );

@naman03malhotra
Copy link
Contributor Author

In the admin, we're still registering a select2 script, which we could also point to selectWoo. It should be safer to even remove it entirely, but I guess there might be extensions out there relying on this for whatever reason.

Good catch @jorgeatorres, I've made the change, also I've kept the version same to avoid duplicate downloads with different hashes.

It should be safer to even remove it entirely, but I guess there might be extensions out there relying on this for whatever reason.

Yep, maybe we can plan a depreciation path for this, but it is safe to have this namespace exposed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
focus: performance The issue/PR is related to performance. plugin: woocommerce Issues related to the WooCommerce Core plugin. type: technical debt This issue/PR represents/solves the technical debt of the project.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Point Select2 to SelectWoo registry
2 participants