Skip to content

Commit 873c947

Browse files
committed
fix: combine useGet watchers so they only fire once on initial render
1 parent 8f2161c commit 873c947

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

src/useGet.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -112,17 +112,12 @@ export default function get(options: UseGetOptions): UseGetData {
112112
}
113113
}
114114

115-
watch(
115+
watch([
116116
() => getId(),
117-
id => {
118-
get(id, getParams())
119-
},
120-
{ lazy }
121-
)
122-
watch(
123117
() => getParams(),
124-
params => {
125-
get(getId(), params)
118+
],
119+
([id, params]) => {
120+
get(id as string | number, params as Params)
126121
},
127122
{ lazy }
128123
)

0 commit comments

Comments
 (0)