Commit d1c8b6cc authored by Sven Franck's avatar Sven Franck

app: set sample_flag_dict to not waste queries to re-check for samples

parent 124f5b24
......@@ -4758,6 +4758,11 @@
*/
app = {};
/**
* Dict to prevent loading samples of multiple portal_types
*/
app.sample_dict = {};
/**
* Fallback for undefined arrays (faster to lookup than to create)
*/
......@@ -6146,7 +6151,8 @@
pass.data_dict.field_dict = util.parse(reply.response);
// try to get 1 record for this portal_type
if (app.storage_dict.property_dict.allow_sample_data && pass.grant &&
if (!app.sample_dict[pass.config_dict.portal_type_source] &&
app.storage_dict.property_dict.allow_sample_data && pass.grant &&
(pass.create !== false) && pass.config_dict.initial_query) {
return storage.fetch({
"pass": pass,
......@@ -6183,6 +6189,9 @@
.then(function (e) {
var response, i, len, promise_list, record;
// set flag to prevent testing for this portal_type again
// (saves a query)
app.sample_dict[pass.config_dict.portal_type_source] = true;
response = util.parse(e.target.responseText);
len = response.length;
promise_list = [];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment