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

Framework: Convert renderWithReduxStore import to CommonJS #12605

Merged
merged 1 commit into from
Mar 28, 2017

Conversation

aduth
Copy link
Contributor

@aduth aduth commented Mar 28, 2017

This pull request seeks to resolve an issue where Safari Private Mode does not load because there are dependencies defined in ES2015 import syntax in the boot file which assume the presence of localStorage. When transpiled, these imports are placed before the localStorage polyfill require and therefore throw an error in Safari Private Mode on attempt to use the unpolyfilled localStorage.

For more stable fix, see in-progress #7232. The changes here simply update the problematic import to CommonJS require syntax, which ensures that polyfill is in the correct order in the transpiled file. See previous issues #7038 and #6558.

Testing Instructions:

Verify that the app boots while logged in, in Safari Private Mode and your preferred browser.

  1. Log in at WordPress.com
  2. Navigate to http://calypso.localhost:3000
  3. Note that the Reader loads without issue

@aduth aduth added Framework [Pri] High Address as soon as possible after BLOCKER issues [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Mar 28, 2017
@aduth aduth requested a review from yurynix March 28, 2017 20:17
@matticbot
Copy link
Contributor

@aduth aduth added [Status] Ready to Merge and removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Mar 28, 2017
@aduth aduth merged commit 925f8f3 into master Mar 28, 2017
@aduth aduth deleted the fix/safari-private branch March 28, 2017 20:28
@gziolo
Copy link
Member

gziolo commented Mar 29, 2017

Could we import file which will require and call polyfill instead? This should work with properly with transpilation.

@ehg ehg mentioned this pull request Mar 29, 2017
3 tasks
@gziolo
Copy link
Member

gziolo commented Mar 29, 2017

@aduth I see now what you have proposed in #7232. It's even better 👍

@@ -50,11 +50,11 @@ var config = require( 'config' ),
syncHandler = require( 'lib/wp/sync-handler' ),
bindWpLocaleState = require( 'lib/wp/localization' ).bindState,
supportUser = require( 'lib/user/support-user-interop' ),
createReduxStoreFromPersistedInitialState = require( 'state/initial-state' ).default;
createReduxStoreFromPersistedInitialState = require( 'state/initial-state' ).default,
renderWithReduxStore = require( 'lib/react-helpers' ).renderWithReduxStore;
Copy link
Member

Choose a reason for hiding this comment

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

From what I tested it also helps when you postpone execution of require( 'lib/user' ) until it is really needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Framework [Pri] High Address as soon as possible after BLOCKER issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants