src/javascript/app_2/Stores/Modules/Trading/trade_store.js
/**
     * Updates the store with new values
     * @param  {Object} new_state - new values to update the store with
     * @return {Object} returns the object having only those values that are updated
     */
Updates the store with new values
@param  {Object} new_state - new values to update the store with
@return {Object} returns the object having only those values that are updated
Updates the store with new values @param { Object } new_state - new values to update the store with @return { Object } returns the object having only those values that are updated
@action.bound
    updateStore(new_state) {
        Object.keys(cloneObject(new_state)).forEach((key) => {
            if (key === 'root_store' || ['validation_rules', 'validation_errors'].indexOf(key) > -1) return;
            if (JSON.stringify(this[key]) === JSON.stringify(new_state[key])) {
                delete new_state[key];
            } else {
                if (key === 'symbol') {
                    this.is_purchase_enabled = false;
                    this.is_trade_enabled    = false;
                }
                if (
                    allowed_query_string_variables.indexOf(key) !== -1 &&
                    this.is_trade_component_mounted
                ) {
                    URLHelper.setQueryParam({ [key]: new_state[key] });
                }
                this[key] = new_state[key];
                if (key === 'barrier_2' && new_state.barrier_1) {
                    this.barrier_1 = new_state.barrier_1; 
                }
            }
        });
        return new_state;
    }
@ action . bound updateStore ( new_state ) { Object . keys ( cloneObject ( new_state ) ) . forEach ( ( key ) => { if ( key === 'root_store' || [ 'validation_rules' , 'validation_errors' ] . indexOf ( key ) > - 1 ) return ; if ( JSON . stringify ( this [ key ] ) === JSON . stringify ( new_state [ key ] ) ) { delete new_state [ key ] ; } else { if ( key === 'symbol' ) { this . is_purchase_enabled = false ; this . is_trade_enabled = false ; } if ( allowed_query_string_variables . indexOf ( key ) !== - 1 && this . is_trade_component_mounted ) { URLHelper . setQueryParam ( { [ key ] : new_state [ key ] } ) ; } this [ key ] = new_state [ key ] ; if ( key === 'barrier_2' && new_state . barrier_1 ) { this . barrier_1 = new_state . barrier_1 ; } } } ) ; return new_state ; }
Updates the store with new values
 @param  {Object} new_state - new values to update the store with
 @return {Object} returns the object having only those values that are updated
Updates the store with new values @param { Object } new_state - new values to update the store with @return { Object } returns the object having only those values that are updated
// Add changes to queryString of the url // validation is done in mobx intercept (base_store.js) // when barrier_1 is set, it is compared with store.barrier_2 (which is not updated yet) // set it again, after barrier_2 is updated in store