Skip to content

Commit

Permalink
fix(useTextDirection): use useLayoutMount to prevent layout jitter
Browse files Browse the repository at this point in the history
  • Loading branch information
vikiboss committed Jul 10, 2024
1 parent b53787a commit fc4743e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/use-text-direction/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useMount } from '../use-mount'
import { useLayoutMount } from '../use-layout-mount'
import { useSafeState } from '../use-safe-state'
import { normalizeElement, useTargetElement } from '../use-target-element'
import { useUpdateEffect } from '../use-update-effect'
Expand Down Expand Up @@ -43,7 +43,7 @@ export function useTextDirection(options: UseTextDirectionOptions = {}): UseText
const el = useTargetElement(target)
const [dir, setDir] = useSafeState(initialValue)

useMount(() => setDir(getDirAttribute(el.current, initialValue)))
useLayoutMount(() => setDir(getDirAttribute(el.current, initialValue)))

useUpdateEffect(() => {
if (!el.current) return
Expand Down

0 comments on commit fc4743e

Please sign in to comment.