[bugfix] DapiMediator: Wait for stack to clear before updating options
This allows the UI to update before we add elements. This really isn't the best place to do this, but it will do for now. DEV-3257master
parent
2e88e9795c
commit
e24038503b
|
@ -166,22 +166,26 @@ module.exports = Class( 'DataApiMediator',
|
|||
: this._getDefaultValue( val_label )
|
||||
);
|
||||
|
||||
indexes.forEach( ( _, i ) =>
|
||||
group.setOptions( name, i, val_label, existing[ i ] )
|
||||
);
|
||||
|
||||
|
||||
const update = this._populateWithMap(
|
||||
dapi_manager, name, indexes, quote
|
||||
);
|
||||
|
||||
update[ name ] = field_update;
|
||||
|
||||
// allow the stack to clear before setting data to allow any
|
||||
// existing bucket processing to complete before hooks are kicked
|
||||
// off yet again (which, in practice, could otherwise result in
|
||||
// infinite recursion depending on what the hooks are doing)
|
||||
setTimeout( () => quote.setData( update ) );
|
||||
// infinite recursion depending on what the hooks are doing), and to
|
||||
// allow the UI to update with any new elements we might be about to
|
||||
// populate
|
||||
setTimeout( () =>
|
||||
{
|
||||
indexes.forEach( ( _, i ) =>
|
||||
group.setOptions( name, i, val_label, existing[ i ] )
|
||||
);
|
||||
|
||||
const update = this._populateWithMap(
|
||||
dapi_manager, name, indexes, quote
|
||||
);
|
||||
|
||||
update[ name ] = field_update;
|
||||
|
||||
quote.setData( update );
|
||||
} );
|
||||
},
|
||||
|
||||
|
||||
|
|
|
@ -368,6 +368,8 @@ describe( "DataApiMediator", () =>
|
|||
[name]: {
|
||||
setOptions( given_name, given_index, given_data, given_cur )
|
||||
{
|
||||
expect( stack_cleared ).to.be.true;
|
||||
|
||||
// index is implicitly tested by the given_cur line
|
||||
expect( given_name ).to.equal( name );
|
||||
expect( given_data ).to.deep.equal( val_label );
|
||||
|
|
Loading…
Reference in New Issue