Skip to content

Commit

Permalink
Update async-initial-values.md (#1058)
Browse files Browse the repository at this point in the history
This approach should be better than the previous one since this infers the type.
  • Loading branch information
turkerdev authored Dec 10, 2024
1 parent 52b9572 commit 504f30d
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions docs/framework/vue/guides/async-initial-values.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,12 @@ const { data, isLoading } = useQuery({
}
});
const defaultValues = reactive({
firstName: '',
lastName: '',
});
const firstName = computed(() => data.value?.firstName || '')
const lastName = computed(() => data.value?.lastName || '')
watchEffect(() => {
if (data.value) {
defaultValues.firstName = data.value.firstName;
defaultValues.lastName = data.value.lastName;
}
const defaultValues = reactive({
firstName,
lastName
});
const form = useForm({
Expand Down

0 comments on commit 504f30d

Please sign in to comment.