Loading apps/demo/src/components/grid.tsx +18 −1 Original line number Diff line number Diff line import { makeStyles, mergeClasses, shorthands } from '@griffel/react'; import { ComponentType, CSSProperties, useLayoutEffect, useMemo, useState } from "react"; import { ComponentType, CSSProperties, useEffect, useLayoutEffect, useMemo, useState } from "react"; import { useStableCallback, withDisplayName } from "../utils"; import { ResizeObserver, Size } from './resize-observer'; Loading Loading @@ -167,8 +167,18 @@ export const Grid = withDisplayName('Grid')(({ const [bodyRef, setBodyRef] = useState<HTMLDivElement | null>(null); const [bodySize, setBodySize] = useState<Size>({ width: 0, height: 0 }); const [autoScroll, setAutoScroll] = useState(true); const handleScroll = useStableCallback(() => { if (bodyRef) { if (autoScroll) { if (scrollTop < bodyRef.scrollHeight - bodyRef.clientHeight && bodyRef.scrollTop < scrollTop) { setAutoScroll(false); } } else if (bodyRef.scrollTop + bodyRef.offsetHeight >= bodyRef.scrollHeight - 50) { setAutoScroll(true); } setScrollLeft(bodyRef.scrollLeft); setScrollTop(bodyRef.scrollTop); } Loading Loading @@ -267,6 +277,13 @@ export const Grid = withDisplayName('Grid')(({ }; }, [columns, bodySize.width]); useEffect(() => { if (autoScroll && bodyRef) { void bodyRef.offsetLeft; bodyRef.scrollTop = bodyRef.scrollHeight; } }); const headers = useMemo(() => ( columnMetadata.columns.map((column, index) => ( <HeaderComponent Loading libraries/android-bin/src/logcat.ts +1 −1 Original line number Diff line number Diff line Loading @@ -168,7 +168,7 @@ export class Logcat extends AdbCommandBase { ...(options?.pid ? ['--pid', options.pid.toString()] : []), ...(options?.ids ? ['-b', Logcat.joinLogId(options.ids)] : []) ], { // PERF: None protocol is 25% faster then Shell protocol // PERF: None protocol is 150% faster then Shell protocol protocols: [AdbSubprocessNoneProtocol], }); bufferedStream = new BufferedStream(stdout); Loading Loading
apps/demo/src/components/grid.tsx +18 −1 Original line number Diff line number Diff line import { makeStyles, mergeClasses, shorthands } from '@griffel/react'; import { ComponentType, CSSProperties, useLayoutEffect, useMemo, useState } from "react"; import { ComponentType, CSSProperties, useEffect, useLayoutEffect, useMemo, useState } from "react"; import { useStableCallback, withDisplayName } from "../utils"; import { ResizeObserver, Size } from './resize-observer'; Loading Loading @@ -167,8 +167,18 @@ export const Grid = withDisplayName('Grid')(({ const [bodyRef, setBodyRef] = useState<HTMLDivElement | null>(null); const [bodySize, setBodySize] = useState<Size>({ width: 0, height: 0 }); const [autoScroll, setAutoScroll] = useState(true); const handleScroll = useStableCallback(() => { if (bodyRef) { if (autoScroll) { if (scrollTop < bodyRef.scrollHeight - bodyRef.clientHeight && bodyRef.scrollTop < scrollTop) { setAutoScroll(false); } } else if (bodyRef.scrollTop + bodyRef.offsetHeight >= bodyRef.scrollHeight - 50) { setAutoScroll(true); } setScrollLeft(bodyRef.scrollLeft); setScrollTop(bodyRef.scrollTop); } Loading Loading @@ -267,6 +277,13 @@ export const Grid = withDisplayName('Grid')(({ }; }, [columns, bodySize.width]); useEffect(() => { if (autoScroll && bodyRef) { void bodyRef.offsetLeft; bodyRef.scrollTop = bodyRef.scrollHeight; } }); const headers = useMemo(() => ( columnMetadata.columns.map((column, index) => ( <HeaderComponent Loading
libraries/android-bin/src/logcat.ts +1 −1 Original line number Diff line number Diff line Loading @@ -168,7 +168,7 @@ export class Logcat extends AdbCommandBase { ...(options?.pid ? ['--pid', options.pid.toString()] : []), ...(options?.ids ? ['-b', Logcat.joinLogId(options.ids)] : []) ], { // PERF: None protocol is 25% faster then Shell protocol // PERF: None protocol is 150% faster then Shell protocol protocols: [AdbSubprocessNoneProtocol], }); bufferedStream = new BufferedStream(stdout); Loading