Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Gerwitz <mike.gerwitz@rtspecialty.com>2018-08-13 12:27:41 -0400
committerMike Gerwitz <mike.gerwitz@rtspecialty.com>2018-08-13 12:29:35 -0400
commitcd56bae35873aa889ab277010d01d5d5a28842ec (patch)
tree3393ca265cd429dfce0da73537d2fbdaf85d13be
parentf6c58621687e5ec8ffb0e483b84187761cb3e5f2 (diff)
downloadliza-cd56bae35873aa889ab277010d01d5d5a28842ec.tar.gz
liza-cd56bae35873aa889ab277010d01d5d5a28842ec.tar.bz2
liza-cd56bae35873aa889ab277010d01d5d5a28842ec.zip
DataApiMediator: Do not check bucket value until after stack clearsv3.9.5
This further highlights that we probably should not be handling this here. We want to ensure that we check the state of the bucket right before we're about to do option setting, otherwise we could be in an inconsistent state (looking at old data). * src/client/dapi/DataApiMediator.js (_updateFieldData): Check bucket after stack clears (along with all other operations).
-rw-r--r--src/client/dapi/DataApiMediator.js48
1 files changed, 24 insertions, 24 deletions
diff --git a/src/client/dapi/DataApiMediator.js b/src/client/dapi/DataApiMediator.js
index 58f9fae..8083262 100644
--- a/src/client/dapi/DataApiMediator.js
+++ b/src/client/dapi/DataApiMediator.js
@@ -143,29 +143,6 @@ module.exports = Class( 'DataApiMediator',
return;
}
- const quote = this._quotef();
- const existing = quote.getDataByName( name ) || [];
-
- let indexes = [];
-
- // index of -1 indicates that all indexes should be affected
- if ( index === -1 )
- {
- indexes = existing;
- }
- else
- {
- indexes[ index ] = index;
- }
-
- // keep existing value if it exists in the result set, otherwise
- // use the first value of the set
- const field_update = indexes.map( ( _, i ) =>
- ( results[ existing[ i ] ] )
- ? existing[ i ]
- : this._getDefaultValue( val_label )
- );
-
// 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
@@ -174,6 +151,29 @@ module.exports = Class( 'DataApiMediator',
// populate
setTimeout( () =>
{
+ const quote = this._quotef();
+ const existing = quote.getDataByName( name ) || [];
+
+ let indexes = [];
+
+ // index of -1 indicates that all indexes should be affected
+ if ( index === -1 )
+ {
+ indexes = existing;
+ }
+ else
+ {
+ indexes[ index ] = index;
+ }
+
+ // keep existing value if it exists in the result set, otherwise
+ // use the first value of the set
+ const field_update = indexes.map( ( _, i ) =>
+ ( results[ existing[ i ] ] )
+ ? existing[ i ]
+ : this._getDefaultValue( val_label )
+ );
+
indexes.forEach( ( _, i ) =>
group.setOptions( name, i, val_label, existing[ i ] )
);
@@ -277,7 +277,7 @@ module.exports = Class( 'DataApiMediator',
const group = this._ui.getCurrentStep().getElementGroup( name );
// ignore unknown fields
- if ( group === undefined )
+ if ( !group )
{
return;
}