diff options
author | David Sun <dvsuner@protonmail.com> | 2019-02-08 09:41:37 +0800 |
---|---|---|
committer | David Sun <dvsuner@protonmail.com> | 2019-02-08 09:41:37 +0800 |
commit | f3716fd813952396aafed7e8bb92e6b4d63ecb7e (patch) | |
tree | c6dbabfede4ce9c8a6baf5ca69751163f6886d7d | |
parent | 6dabed5938a4ccefbc7c8966f8b3f4fbb83acf11 (diff) | |
download | dexon-0x-contracts-f3716fd813952396aafed7e8bb92e6b4d63ecb7e.tar.gz dexon-0x-contracts-f3716fd813952396aafed7e8bb92e6b4d63ecb7e.tar.zst dexon-0x-contracts-f3716fd813952396aafed7e8bb92e6b4d63ecb7e.zip |
fixed config orderSource assignment
-rw-r--r-- | packages/instant/src/index.umd.ts | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/packages/instant/src/index.umd.ts b/packages/instant/src/index.umd.ts index 7b2b45a71..243bb569b 100644 --- a/packages/instant/src/index.umd.ts +++ b/packages/instant/src/index.umd.ts @@ -94,21 +94,24 @@ export interface ZeroExInstantConfig extends ZeroExInstantOverlayProps { } export const render = (config: ZeroExInstantConfig, selector: string = DEFAULT_ZERO_EX_CONTAINER_SELECTOR) => { - if (_.isArray(config.orderSource)) { - config.orderSource = orderCoercionUtil.coerceOrderArrayFieldsToBigNumber(config.orderSource); - } + // Coerces BigNumber provided in config to version utilized by 0x packages + const coercedConfig = _.assign({}, config, { + orderSource: _.isArray(config.orderSource) + ? orderCoercionUtil.coerceOrderArrayFieldsToBigNumber(config.orderSource) + : config.orderSource, + }); - validateInstantRenderConfig(config, selector); + validateInstantRenderConfig(coercedConfig, selector); - if (config.shouldDisablePushToHistory) { + if (coercedConfig.shouldDisablePushToHistory) { if (!isInstantRendered()) { - renderInstant(config, selector); + renderInstant(coercedConfig, selector); } return; } // Before we render, push to history saying that instant is showing for this part of the history. window.history.pushState({ zeroExInstantShowing: true }, '0x Instant'); - let removeInstant = renderInstant(config, selector); + let removeInstant = renderInstant(coercedConfig, selector); // If the integrator defined a popstate handler, save it to __zeroExInstantIntegratorsPopStateHandler // unless we have already done so on a previous render. const anyWindow = window as any; @@ -122,7 +125,7 @@ export const render = (config: ZeroExInstantConfig, selector: string = DEFAULT_Z if (newState && newState.zeroExInstantShowing) { // We have returned to a history state that expects instant to be rendered. if (!isInstantRendered()) { - removeInstant = renderInstant(config, selector); + removeInstant = renderInstant(coercedConfig, selector); } } else { // History has changed to a different state. |