Skip to content

Compose: Drop explicit window reference from withSafeTimeout - #9266

Merged
gziolo merged 1 commit into
WordPress:masterfrom
ockham:remove/with-safe-timeout-explicit-window-reference
Aug 25, 2018
Merged

gziolo merged 1 commit into
WordPress:masterfrom
ockham:remove/with-safe-timeout-explicit-window-reference

Conversation

@ockham

@ockham ockham commented Aug 23, 2018 •

Copy link
Copy Markdown
Contributor

Description

Fixes #9265, i.e. makes withSafeTimeout compatible with server side rendering.

How has this been tested?

TBD

Types of changes

Both setTimeout and clearTimeout are methods of the window object, so they are be globally available -- as they are in Node. Removing the explicit window reference unbreaks this for use with Node.

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.

@gziolo gziolo added the [Type] Code Quality Issues or PRs that relate to code quality label Aug 25, 2018
@gziolo gziolo added this to the 3.7 milestone Aug 25, 2018
@gziolo gziolo added the Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change) label Aug 25, 2018

@gziolo gziolo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The same applies to React Native. It also doesn’t have window object. We should be doing it only for browser specific APIs

@gziolo
gziolo merged commit a6ac21d into WordPress:master Aug 25, 2018
@ockham
ockham deleted the remove/with-safe-timeout-explicit-window-reference branch August 25, 2018 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change) [Type] Code Quality Issues or PRs that relate to code quality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants