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

Data: Registry - check for window #9261

Merged
merged 2 commits into from Aug 25, 2018

Conversation

Projects
None yet
3 participants
@coderkevin
Contributor

coderkevin commented Aug 23, 2018

Description

The current registry code is blindly deferencing window, which will fail if ever
run in node for test or server-side rendering. This adds a simple check
to ensure window exists before dereferencing.

How has this been tested?

There's not much to test for this line, as it only affects redux dev tools when there is no global window instance, which should never happen.

Types of changes

Sort of a bug fix maybe? As this code is causing a CI test to fail for Calypso: Automattic/wp-calypso#26838

This change should not break a thing, as it's just doing an additional check.

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
Data: Registry - check for window
The registry code is blindly deferencing window, which will fail if ever
run in node for test or server-side rendering. This adds a simple check
to ensure window exists before dereferencing.

@gziolo gziolo added this to the 3.7 milestone Aug 25, 2018

@gziolo

gziolo approved these changes Aug 25, 2018

👍 it should help React Native, too.

@gziolo gziolo merged commit 7db0880 into WordPress:master Aug 25, 2018

2 checks passed

codecov/project Absolute coverage decreased by -<.01% but relative coverage increased by +49.3% compared to e959064
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

ZebulanStanphill added a commit to ZebulanStanphill/gutenberg that referenced this pull request Aug 25, 2018

Data: Registry - check for window (#9261)
* Data: Registry - check for window

The registry code is blindly deferencing window, which will fail if ever
run in node for test or server-side rendering. This adds a simple check
to ensure window exists before dereferencing.

* Data: Check window type before using

ZebulanStanphill added a commit to ZebulanStanphill/gutenberg that referenced this pull request Aug 25, 2018

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