mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-22 08:15:53 +00:00
style: 完成所有文件的lint
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import React, { useContext, useRef } from 'react'
|
||||
import { useTerminalViewport, Box } from '@anthropic/ink'
|
||||
import { InVirtualListContext } from './messageActions.js'
|
||||
import React, { useContext, useRef } from 'react';
|
||||
import { useTerminalViewport, Box } from '@anthropic/ink';
|
||||
import { InVirtualListContext } from './messageActions.js';
|
||||
|
||||
type Props = {
|
||||
children: React.ReactNode
|
||||
}
|
||||
children: React.ReactNode;
|
||||
};
|
||||
|
||||
/**
|
||||
* Freezes children when they scroll above the terminal viewport (into scrollback).
|
||||
@@ -23,16 +23,16 @@ type Props = {
|
||||
export function OffscreenFreeze({ children }: Props): React.ReactNode {
|
||||
// React Compiler: reading cached.current in the return is the entire
|
||||
// freeze mechanism — memoizing this component would defeat it. Opt out.
|
||||
'use no memo'
|
||||
const inVirtualList = useContext(InVirtualListContext)
|
||||
const [ref, { isVisible }] = useTerminalViewport()
|
||||
const cached = useRef(children)
|
||||
'use no memo';
|
||||
const inVirtualList = useContext(InVirtualListContext);
|
||||
const [ref, { isVisible }] = useTerminalViewport();
|
||||
const cached = useRef(children);
|
||||
// Virtual list has no terminal scrollback — the ScrollBox clips inside the
|
||||
// viewport, so there's nothing to freeze. Freezing there also blocks
|
||||
// click-to-expand since useTerminalViewport's visibility calc can disagree
|
||||
// with the ScrollBox's virtual scroll position.
|
||||
if (isVisible || inVirtualList) {
|
||||
cached.current = children
|
||||
cached.current = children;
|
||||
}
|
||||
return <Box ref={ref}>{cached.current}</Box>
|
||||
return <Box ref={ref}>{cached.current}</Box>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user