aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src
diff options
context:
space:
mode:
authorDavid Sun <dvsuner@protonmail.com>2019-02-08 09:41:37 +0800
committerDavid Sun <dvsuner@protonmail.com>2019-02-08 09:41:37 +0800
commitf3716fd813952396aafed7e8bb92e6b4d63ecb7e (patch)
treec6dbabfede4ce9c8a6baf5ca69751163f6886d7d /packages/instant/src
parent6dabed5938a4ccefbc7c8966f8b3f4fbb83acf11 (diff)
downloaddexon-0x-contracts-f3716fd813952396aafed7e8bb92e6b4d63ecb7e.tar.gz
dexon-0x-contracts-f3716fd813952396aafed7e8bb92e6b4d63ecb7e.tar.zst
dexon-0x-contracts-f3716fd813952396aafed7e8bb92e6b4d63ecb7e.zip
fixed config orderSource assignment
Diffstat (limited to 'packages/instant/src')
-rw-r--r--packages/instant/src/index.umd.ts19
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.