UI Loader: Fix flickering with resized Left Column (#2030)

This commit is contained in:
Alexander Zinchuk 2022-09-13 10:22:44 +02:00
parent 2a6debb587
commit 45dee440a7

View File

@ -1,5 +1,5 @@
import type { RefObject } from 'react'; import type { RefObject } from 'react';
import { useState, useEffect } from '../lib/teact/teact'; import { useState, useEffect, useLayoutEffect } from '../lib/teact/teact';
import useFlag from './useFlag'; import useFlag from './useFlag';
export function useResize( export function useResize(
@ -12,7 +12,7 @@ export function useResize(
const [initialMouseX, setInitialMouseX] = useState<number>(); const [initialMouseX, setInitialMouseX] = useState<number>();
const [initialElementWidth, setInitialElementWidth] = useState<number>(); const [initialElementWidth, setInitialElementWidth] = useState<number>();
useEffect(() => { useLayoutEffect(() => {
if (!elementRef.current || !initialWidth) { if (!elementRef.current || !initialWidth) {
return; return;
} }