From 274f1492726feb64ddf5298359d213b4afed8101 Mon Sep 17 00:00:00 2001 From: Brett Sun Date: Tue, 15 Dec 2015 16:26:40 +0100 Subject: [PATCH 1/2] Make sure polyfill is loaded first by using import statement MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ES6 `import` statements hoist their imports to the top of the file. Using `require(‘babel/polyfill’)` actually loads the polyfill after the other imports, causing errors. --- js/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/app.js b/js/app.js index 520bedbd..e49ee46b 100644 --- a/js/app.js +++ b/js/app.js @@ -1,6 +1,6 @@ 'use strict'; -require('babel/polyfill'); +import polyfill from 'babel/polyfill'; import React from 'react'; import { Router, Redirect } from 'react-router'; From 5ee3b07cc12eb9c2c52d154687608dddeb04c504 Mon Sep 17 00:00:00 2001 From: Brett Sun Date: Tue, 15 Dec 2015 16:26:49 +0100 Subject: [PATCH 2/2] Revert "Hotfix for iOS Safari mergeOptions clashes" This reverts commit 1b4c6938f603ada02a16f91c223054298f497e88. The actual problem was the late loading of the polyfills. --- js/sources/coa_source.js | 27 +++++++++++++++++++++++++++ js/sources/edition_source.js | 20 +------------------- js/stores/edition_store.js | 5 ++++- 3 files changed, 32 insertions(+), 20 deletions(-) create mode 100644 js/sources/coa_source.js diff --git a/js/sources/coa_source.js b/js/sources/coa_source.js new file mode 100644 index 00000000..88c72cce --- /dev/null +++ b/js/sources/coa_source.js @@ -0,0 +1,27 @@ +'use strict'; + +import requests from '../utils/requests'; + +import EditionActions from '../actions/edition_actions'; + + +const CoaSource = { + lookupCoa: { + remote(state) { + return requests.get('coa', { id: state.edition.coa }); + }, + + success: EditionActions.successFetchCoa, + error: EditionActions.errorCoa + }, + + performCreateCoa: { + remote(state) { + return requests.post('coa_create', {body: { bitcoin_id: state.edition.bitcoin_id }}); + }, + success: EditionActions.successFetchCoa, + error: EditionActions.errorCoa + } +}; + +export default CoaSource; \ No newline at end of file diff --git a/js/sources/edition_source.js b/js/sources/edition_source.js index 462205e0..3e48d257 100644 --- a/js/sources/edition_source.js +++ b/js/sources/edition_source.js @@ -13,25 +13,7 @@ const EditionSource = { success: EditionActions.successFetchEdition, error: EditionActions.errorEdition - }, - - // For COA - lookupCoa: { - remote(state) { - return requests.get('coa', { id: state.edition.coa }); - }, - - success: EditionActions.successFetchCoa, - error: EditionActions.errorCoa - }, - - performCreateCoa: { - remote(state) { - return requests.post('coa_create', {body: { bitcoin_id: state.edition.bitcoin_id }}); - }, - success: EditionActions.successFetchCoa, - error: EditionActions.errorCoa } }; -export default EditionSource; +export default EditionSource; \ No newline at end of file diff --git a/js/stores/edition_store.js b/js/stores/edition_store.js index ae728ef9..8fdd681b 100644 --- a/js/stores/edition_store.js +++ b/js/stores/edition_store.js @@ -5,6 +5,9 @@ import { alt } from '../alt'; import EditionActions from '../actions/edition_actions'; import EditionSource from '../sources/edition_source'; +import CoaSource from '../sources/coa_source'; + +import { mergeOptions } from '../utils/general_utils'; class EditionStore { @@ -19,7 +22,7 @@ class EditionStore { }; this.bindActions(EditionActions); - this.registerAsync(EditionSource); + this.registerAsync(mergeOptions(EditionSource, CoaSource)); } onFetchEdition(idToFetch) {