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

Uncaught TypeError: Cannot read properties of undefined (reading 'isSavingPost') #182

Closed
1 task done
turtlepod opened this issue Mar 21, 2024 · 6 comments · Fixed by #187
Closed
1 task done

Uncaught TypeError: Cannot read properties of undefined (reading 'isSavingPost') #182

turtlepod opened this issue Mar 21, 2024 · 6 comments · Fixed by #187
Labels
help wanted Extra attention is needed type:bug Something isn't working.
Milestone

Comments

@turtlepod
Copy link
Member

Describe the bug

JS fatal error. Uncaught TypeError: Cannot read properties of undefined (reading 'isSavingPost')

Steps to Reproduce

Enable Safe SVG in Classic Editor Edit Post

Screenshots, screen recording, code snippet

image

Environment information

WPEngine

WordPress information

WordPress 6.4.x

Code of Conduct

  • I agree to follow this project's Code of Conduct
@turtlepod turtlepod added the type:bug Something isn't working. label Mar 21, 2024
@turtlepod
Copy link
Member Author

@dkotter I think it's because of this line of code:

add_action( 'admin_enqueue_scripts', [ $this, 'enqueues' ] );

The JS need gutenberg, so, technically, this need to be updated from admin_enqueue_scripts to enqueue_block_editor_assets ?

@jeffpaul jeffpaul added this to the 2.3.0 milestone Mar 21, 2024
@jeffpaul jeffpaul added the help wanted Extra attention is needed label Mar 21, 2024
@jeffpaul jeffpaul moved this from Incoming to To Do in Open Source Practice Mar 21, 2024
@dkotter
Copy link
Collaborator

dkotter commented Mar 25, 2024

@turtlepod That makes sense to me but I've been unable to reproduce this.

That JS file is only loaded if the optimizer feature is enabled (do this by returning true in the safe_svg_optimizer_enabled filter). I've set this up and I see the file loading but I'm not getting any errors in the console when testing in the Classic Editor. Are there other steps I need to take?

@dkotter
Copy link
Collaborator

dkotter commented Mar 25, 2024

And I guess one other thing in thinking through this more, I believe this was set up to fire not only in the editor but when media is directly uploaded, so I think loading the script on enqueue_block_editor_assets would break that functionality

@turtlepod
Copy link
Member Author

@dkotter I tested and I can reproduce. Yes, this issue is only if we use the safe_svg_optimizer_enabled filter.
Apparently the issue is probably a conflict with Yoast SEO. Can you confirm this and simply enable Yoast to check?
Thanks

@dkotter
Copy link
Collaborator

dkotter commented Mar 26, 2024

@turtlepod Thanks for the additional information. I had originally tested with Yoast but couldn't reproduce the issue. Turns out I had another plugin installed that was loading the proper dependencies which fixed the issue. I've opened #187 to address this, if you have time to test that and ensure it fixes things for you.

@dkotter dkotter modified the milestones: 2.3.0, 2.2.4 Mar 26, 2024
@turtlepod
Copy link
Member Author

@dkotter I tested and the fix is working as expected! Thank you!

@github-project-automation github-project-automation bot moved this from To Do to Merged in Open Source Practice Mar 27, 2024
@vikrampm1 vikrampm1 moved this from Merged to Done/Released in Open Source Practice Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed type:bug Something isn't working.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants