Skip to content

Commit 8f2161c

Browse files
committed
Revert "fix duplicate queries with useGet"
This reverts commit f72deca.
1 parent 0af97a1 commit 8f2161c

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

docs/composition-api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ And here's a look at each individual property:
281281
- `params` is a FeathersJS Params object OR a Composition API `ref` (or `computed`, since they return a `ref` instance) which returns a Params object.
282282
- Unlike the `useFind` utility, `useGet` does not currently have built-in debouncing.
283283
- `queryWhen` must be a `computed` property which returns a `boolean`. It provides a logical separation for preventing API requests apart from `null` in the `id`.
284-
- `lazy`, which is `true` by default, determines if the internal `watch` should fire immediately. By default a single query will be performed, independent of the watchers. Set `lazy: false` and the watchers on the `id` and `params` will fire immediately (currently this will cause duplicate queries to be performed, so it's not recommended).
284+
- `lazy`, which is `false` by default, determines if the internal `watch` should fire immediately. Set `lazy: true` and the query will not fire immediately. It will only fire on subsequent changes to the `id` or `params`.
285285
286286
### Returned Attributes
287287

src/useGet.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export default function get(options: UseGetOptions): UseGetData {
4646
params: null,
4747
queryWhen: computed((): boolean => true),
4848
local: false,
49-
lazy: true
49+
lazy: false
5050
}
5151
const { model, id, params, queryWhen, local, lazy } = Object.assign(
5252
{},
@@ -127,10 +127,6 @@ export default function get(options: UseGetOptions): UseGetData {
127127
{ lazy }
128128
)
129129

130-
if (lazy) {
131-
get(id, getParams())
132-
}
133-
134130
return {
135131
servicePath,
136132
...toRefs(state),

0 commit comments

Comments
 (0)