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

Fix props mutation causing a crash in a strict mode #39

Merged
merged 2 commits into from
Aug 25, 2020

Conversation

jeffersonrabb
Copy link

@jeffersonrabb jeffersonrabb commented Aug 25, 2020

All Submissions:

Changes proposed in this Pull Request:

Fixes an issue appearing when SCRIPT_DEBUG is set. Props is read-only, so mutating it probably causes a crash in the stricter mode enforced by SCRIPT_DEBUG.

How to test the changes in this Pull Request:

  1. On master
  2. Enable SCRIPT_DEBUG in wp-config.php
  3. Load a post with a sponsor set
  4. Observe editor crashing
  5. Switch to this branch, rebuild
  6. Redo step 3, observe editor not crashing

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully ran tests with your changes locally?

jeffersonrabb and others added 2 commits August 25, 2020 08:24
Props is read-only. This fix destructures props to a new variable where hasCreateAction can safely be nulled out if necessary.
@adekbadek adekbadek changed the title fix: editor crash Fix props mutation causing a crash in a strict mode Aug 25, 2020
@adekbadek adekbadek marked this pull request as ready for review August 25, 2020 13:04
@jeffersonrabb
Copy link
Author

Improvement LGTM.

@adekbadek adekbadek merged commit c86e555 into master Aug 25, 2020
@adekbadek adekbadek deleted the fix/editor-crash branch August 25, 2020 14:43
matticbot pushed a commit that referenced this pull request Aug 25, 2020
# [1.2.0-alpha.1](v1.1.0...v1.2.0-alpha.1) (2020-08-25)

### Bug Fixes

* a safer way of overwriting the prop ([#39](#39)) ([c86e555](c86e555))
* checkout --> checkout_with_workspace ([#34](#34)) ([8138a11](8138a11))
* install rsync as part of release job ([efa53fc](efa53fc))
* merge conflicts ([9a2ed5d](9a2ed5d))
* semantic release config ([2366839](2366839))
* semantic release config ([#29](#29)) ([e116c58](e116c58))

### Features

* settings use value instead of placeholder ([#36](#36)) ([7276c5d](7276c5d))
* update sponsors icon to Material Design ([#35](#35)) ([b2719bf](b2719bf))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 1.2.0-alpha.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

matticbot pushed a commit that referenced this pull request Aug 25, 2020
# [1.2.0](v1.1.0...v1.2.0) (2020-08-25)

### Bug Fixes

* a safer way of overwriting the prop ([#39](#39)) ([c86e555](c86e555))
* checkout --> checkout_with_workspace ([#34](#34)) ([8138a11](8138a11))
* install rsync as part of release job ([efa53fc](efa53fc))
* merge conflicts ([9a2ed5d](9a2ed5d))
* semantic release config ([2366839](2366839))
* semantic release config ([#29](#29)) ([e116c58](e116c58))

### Features

* settings use value instead of placeholder ([#36](#36)) ([7276c5d](7276c5d))
* update sponsors icon to Material Design ([#35](#35)) ([b2719bf](b2719bf))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 1.2.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants