Skip to content

Commit

Permalink
fix: do not force update resources
Browse files Browse the repository at this point in the history
  • Loading branch information
ci010 committed Sep 1, 2019
1 parent 0925401 commit 21b118e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/universal/store/modules/resource.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const mod = {
return undefined;
default:
for (const domain of Object.values(state.domains)) {
if (domain[q]) return domain[q];
if (domain[qObject]) return domain[qObject];
}
}
}
Expand Down Expand Up @@ -78,15 +78,20 @@ const mod = {
},
resource: (state, res) => {
if (res.domain in state.domains) {
Vue.set(state.domains[res.domain], res.hash, res);
Vue.set(state.domains[res.domain], res.hash, Object.freeze(res));
} else {
console.error(`Cannot accept resource for unknown domain [${res.domain}]`);
}
},
resources: (state, all) => {
console.log(`Accept resource ${all.length}`);
for (const res of all) {
if (res.domain in state.domains) {
Vue.set(state.domains[res.domain], res.hash, res);
if (!state.domains[res.domain][res.hash]) {
Vue.set(state.domains[res.domain], res.hash, Object.freeze(res));
} else {
state.domains[res.domain][res.hash] = Object.freeze(res);
}
} else {
console.error(`Cannot accept resource for unknown domain [${res.domain}]`);
}
Expand Down

0 comments on commit 21b118e

Please sign in to comment.