Fork 0

[DEV-6968] Client: Hook classifier after initQuote

This saves a lot of time for large classifiers by waiting to invoke it until
after some initial bucket setup has been done.  In particular, initQuote.

DelayedStagingBucket exists to try to limit the number of events that are
kicked off.  In this case, initQuote typically uses setCommittedValues,
which DelayedStagingBucket does not override.  However, overriding it did
not provide a whole lot of benefit, since initQuote also calls
getDataByName, which forces DelayedStagingBucket to flush so that hooks can
run validations and such.

The last step in Client#_changeQuote is to force the classifier to run, so
this should be safe, unless calculated values happen to use classification
results, in which case they'll be momentarily wrong and then immediately
updated after the classifier runs.
Mike Gerwitz 2020-02-03 14:37:32 -05:00
parent 671f7cc6cb
commit 1aa51775f3
1 changed files with 2 additions and 2 deletions

View File

@ -507,8 +507,6 @@ module.exports = Class( 'Client' )
client._monitorQuote( client._quote );
client._cmatch.hookClassifier( client._dataValidator );
// store internal status
client._isInternal = client.program.isInternal =
( data.content.internal )
@ -528,6 +526,8 @@ module.exports = Class( 'Client' )
client.program.initQuote( bucket );
} );
client._cmatch.hookClassifier( client._dataValidator );
client.ui.setQuote( client._quote, client.program, clear_step );
// if logged in internally, show internal questions and do other