File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -26,17 +26,25 @@ export default defineStore('model-data', () => {
26
26
const apiKey = useAppRefKey ( ) ;
27
27
28
28
const model = useModel ( ) ;
29
- const modelId = computed ( ( ) => model . target ! . id ) ;
29
+ const modelId = computed ( ( ) => model . target ? .id ) ;
30
30
31
31
const { data, pending, refresh } = useLazyFetch < NormalizedModelData [ ] > (
32
32
( ) => `/models/${ modelId . value } /model-data` ,
33
33
{
34
34
method : 'GET' ,
35
35
query : { apiKey } ,
36
36
server : false ,
37
+ // So we can manually fetch
38
+ watch : false ,
37
39
}
38
40
) ;
39
41
42
+ watch ( modelId , ( ) => {
43
+ if ( modelId . value ) {
44
+ refresh ( ) ;
45
+ }
46
+ } )
47
+
40
48
const list = computed ( ( ) => data . value || [ ] ) ;
41
49
const isDisabled = computed ( ( ) => list . value . length === 50 || pending . value ) ;
42
50
You can’t perform that action at this time.
0 commit comments