force reload quests after submitting one
This commit is contained in:
parent
8373ee50de
commit
d8ac955d69
1 changed files with 7 additions and 7 deletions
|
@ -1456,7 +1456,7 @@ c3nav = {
|
|||
_modal_click: function (e) {
|
||||
if (!c3nav.modal_noclose && (e.target.id === 'modal' || e.target.id === 'close-modal')) {
|
||||
history.back();
|
||||
if (c3nav._questsControl) c3nav._questsControl.reloadQuests();
|
||||
if (c3nav._questsControl) c3nav._questsControl.reloadQuests(true);
|
||||
}
|
||||
},
|
||||
_href_modal_open_tab: function (location) {
|
||||
|
@ -2734,15 +2734,19 @@ QuestsControl = ExpandingControl.extend({
|
|||
this.reloadQuests().catch(err => console.error(err));
|
||||
},
|
||||
|
||||
reloadQuests: async function() {
|
||||
reloadQuests: async function (force = false) {
|
||||
const activeQuests = this._activeQuests;
|
||||
const removed = this._loadedQuests.difference(activeQuests);
|
||||
const added = activeQuests.difference(this._loadedQuests);
|
||||
const added = force ? activeQuests : activeQuests.difference(this._loadedQuests);
|
||||
|
||||
if (removed.size === 0 && added.size === 0) return;
|
||||
|
||||
const questData = this._questData;
|
||||
|
||||
for (const name of removed) {
|
||||
delete questData[name];
|
||||
}
|
||||
|
||||
if (added.size > 0) {
|
||||
for(const name of added) {
|
||||
questData[name] = [];
|
||||
|
@ -2755,10 +2759,6 @@ QuestsControl = ExpandingControl.extend({
|
|||
}
|
||||
}
|
||||
|
||||
for (const name of removed) {
|
||||
delete questData[name];
|
||||
}
|
||||
|
||||
this._questData = questData;
|
||||
this._loadedQuests = new Set([...activeQuests]);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue