Fix race condition #32781

This commit is contained in:
Nicolas Demonte 2020-04-07 16:40:54 +02:00
parent 5693bcb77d
commit 6b84fcd84d
1 changed files with 17 additions and 7 deletions

View File

@ -533,13 +533,23 @@ function select_metatype(elem)
$('div.close', window.parent.document).click();
});
var history_state = history.state;
if (history_state !== null) {
if (history_state.metatype !== undefined) {
var metatype = $('.metatypes [value="' + history_state.metatype + '"]');
metatype.prop('checked', true);
metatype.trigger('change');
/* search restoration starts here */
var restore_ppfwbged_search = function() {
var history_state = history.state;
if (history_state !== null) {
if (history_state.metatype !== undefined) {
var metatype = $('.metatypes [value="' + history_state.metatype + '"]');
metatype.prop('checked', true).trigger('change');
}
}
}
};
var waitForQuerywidget = setInterval(function () {
if ($.querywidget.initialized_over === true) {
restore_ppfwbged_search();
clearInterval(waitForQuerywidget);
}
}, 500);
}(jQuery));