Skip to content

Commit ca202e7

Browse files
committed
Yet another recommended method fails. #34
1 parent 884ac3d commit ca202e7

File tree

1 file changed

+17
-30
lines changed

1 file changed

+17
-30
lines changed

src/views/Registry/GraphView.vue

Lines changed: 17 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -315,23 +315,22 @@ export default {
315315
},
316316
async setup() {
317317
const store = useAdvancedSearchStore();
318-
// This watch is here because I can't find any way to get it to work in `watch:` below.
319-
/*
320-
watch(() => store.getAdvancedSearchResponse, async () => {
321-
console.log("We need to be able to call a method here but can't.");
322-
//await this.getData(store.getAdvancedSearchResponse.map((x) => x.id).join(','));
323-
})
324-
// apparently one is supposed to use storeToRefs on the store, export the ref, and
325-
// watch that below. But, whatever formulation I try, it is never reactive.
326-
*/
327-
328-
const { advancedSearchResponse } = storeToRefs(store);
318+
const advancedSearchResponse = storeToRefs(store);
329319
return { store, advancedSearchResponse };
330320
},
331321
computed: {
322+
/*
332323
...mapState(useAdvancedSearchStore, {
333324
getAdvancedSearchResponse: 'getAdvancedSearchResponse',
334325
}),
326+
*/
327+
/*
328+
graphIds() {
329+
let data = this.store.map((x) => x.id).join(',');
330+
console.log("GID :" + JSON.stringify(data));
331+
return data;
332+
},
333+
*/
335334
noData() {
336335
if (this.store.getNoData) {
337336
return "No data available";
@@ -344,26 +343,13 @@ export default {
344343
return this.fa2Layout.isRunning();
345344
},
346345
},
347-
/*
348-
watch: {
349-
useAdvancedSearchStore: {
350-
immediate: true,
351-
deep: true,
352-
handler(newValue, oldValue) {
353-
console.log("Javascript sucks!");
354-
this.$nextTick(() => {
355-
console.log("Watched!");
356-
console.log("OLD: " + JSON.stringify(oldValue));
357-
console.log("NEW: " + JSON.stringify(newValue));
358-
})
359-
}
360-
}
361-
},
362-
*/
363346
watch: {
364-
getAdvancedSearchResponse(newVal) {
365-
console.log("getAdvancedSearchResponse", JSON.stringify(newVal));
366-
this.plotGraph();
347+
advancedSearchResponse: {
348+
handler(newValue, oldValue) {
349+
console.log(newValue);
350+
this.plotGraph();
351+
},
352+
deep: true
367353
}
368354
},
369355
/*
@@ -445,6 +431,7 @@ export default {
445431
*/
446432
},
447433
async plotGraph(){
434+
console.log("plotGraph");
448435
let _module = this;
449436
graph.clear();
450437
graph.import(this.graphData);

0 commit comments

Comments
 (0)