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

Add another dependency to our optimizer script #187

Merged
merged 2 commits into from
Mar 27, 2024
Merged

Conversation

dkotter
Copy link
Collaborator

@dkotter dkotter commented Mar 26, 2024

Description of the Change

As described in #182, when using the optimizer feature and running in the Classic Editor, there's a chance for JS errors that can cause conflicts with other features (in this case Yoast SEO).

The problem is we call the method isSavingPost which doesn't natively exist in the Classic Editor. This PR fixes this by adding wp-editor as a dependency to our optimizer script.

Closes #182

How to test the Change

  1. In a clean environment, install the Classic Editor plugin, Yoast SEO and Safe SVG
  2. Add the following code to turn on the optimizer feature: add_filter( 'safe_svg_optimizer_enabled', '__return_true' );
  3. Create a new classic post and you should see a JS error in the console. In addition, the Yoast SEO panel won't load properly
  4. Checkout this PR and ensure that error goes away
  5. If desired, deactivate the Classic Editor plugin and test that things still work properly in the Block Editor

Changelog Entry

Fixed - Ensure we don't throw JS errors in the Classic Editor when the optimizer feature is turned on.

Credits

Props @dkotter, @turtlepod

Checklist:

  • I agree to follow this project's Code of Conduct.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests pass.

@dkotter dkotter self-assigned this Mar 26, 2024
@dkotter dkotter requested a review from jeffpaul as a code owner March 26, 2024 14:26
@dkotter dkotter requested review from faisal-alvi and removed request for jeffpaul March 26, 2024 14:26
@dkotter dkotter added this to the 2.3.0 milestone Mar 26, 2024
@dkotter dkotter modified the milestones: 2.3.0, 2.2.4 Mar 26, 2024
Copy link
Member

@faisal-alvi faisal-alvi left a comment

Choose a reason for hiding this comment

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

Thanks for the fix @dkotter.

before

image

after

image

@faisal-alvi faisal-alvi merged commit 259a573 into develop Mar 27, 2024
13 checks passed
@faisal-alvi faisal-alvi deleted the fix/182 branch March 27, 2024 10:39
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.

Uncaught TypeError: Cannot read properties of undefined (reading 'isSavingPost')
2 participants