bugfix: improve reactivity

This commit is contained in:
Matthieu Fesselier
2021-05-19 10:25:10 +02:00
parent d1dc13fef1
commit 83a02135fc
4 changed files with 18 additions and 14 deletions

View File

@ -15,6 +15,9 @@ export const HublReactivity = {
this.subscribe();
}
},
refreshData: {
type: String,
},
},
async fetchData(value) {
this.resourceId = null;
@ -28,9 +31,10 @@ export const HublReactivity = {
this.subscribe();
},
subscribe() {
if (this.resourceId && this.targetSrc) {
if (this.refreshData === '') { // clears cache and re-fetch data
store.subscribeVirtualContainerTo(this.resourceId, this.targetSrc);
store.subscribeVirtualContainerTo(this.targetSrc, this.resourceId);
} else { // notifies components
store.subscribeResourceTo(this.resourceId, this.targetSrc);
}
}
}