Skip to content

Commit

Permalink
fix(useTextareaAutosize): autosize error when changing input asynch…
Browse files Browse the repository at this point in the history
…ronously (#3118)
  • Loading branch information
jsonleex committed Jun 6, 2023
1 parent 4b4e6c2 commit 1b0ec28
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/core/useTextareaAutosize/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { MaybeRef } from '@vueuse/shared'
import { toValue } from '@vueuse/shared'
import type { WatchSource } from 'vue-demi'
import { ref, watch } from 'vue-demi'
import { nextTick, ref, watch } from 'vue-demi'
import { useResizeObserver } from '../useResizeObserver'

export interface UseTextareaAutosizeOptions {
Expand Down Expand Up @@ -43,7 +43,7 @@ export function useTextareaAutosize(options?: UseTextareaAutosizeOptions) {
options?.onResize?.()
}

watch([input, textarea], triggerResize, { immediate: true })
watch([input, textarea], () => nextTick(triggerResize), { immediate: true })

useResizeObserver(textarea, () => triggerResize())

Expand Down

0 comments on commit 1b0ec28

Please sign in to comment.