forked from XiaoMo/ChatGPT-Next-Web
fixup
This commit is contained in:
parent
ae8050a3f7
commit
116e16e30d
@ -725,6 +725,7 @@ export function Chat() {
|
|||||||
}}
|
}}
|
||||||
fontSize={fontSize}
|
fontSize={fontSize}
|
||||||
parentRef={scrollRef}
|
parentRef={scrollRef}
|
||||||
|
defaultShow={i >= messages.length - 10}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{!isUser && !message.preview && (
|
{!isUser && !message.preview && (
|
||||||
|
@ -62,11 +62,12 @@ export function Markdown(
|
|||||||
loading?: boolean;
|
loading?: boolean;
|
||||||
fontSize?: number;
|
fontSize?: number;
|
||||||
parentRef: RefObject<HTMLDivElement>;
|
parentRef: RefObject<HTMLDivElement>;
|
||||||
|
defaultShow?: boolean;
|
||||||
} & React.DOMAttributes<HTMLDivElement>,
|
} & React.DOMAttributes<HTMLDivElement>,
|
||||||
) {
|
) {
|
||||||
const mdRef = useRef<HTMLDivElement>(null);
|
const mdRef = useRef<HTMLDivElement>(null);
|
||||||
const renderedHeight = useRef(0);
|
const renderedHeight = useRef(0);
|
||||||
const inView = useRef(false);
|
const inView = useRef(!!props.defaultShow);
|
||||||
|
|
||||||
const parent = props.parentRef.current;
|
const parent = props.parentRef.current;
|
||||||
const md = mdRef.current;
|
const md = mdRef.current;
|
||||||
@ -90,15 +91,6 @@ export function Markdown(
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
setTimeout(() => {
|
|
||||||
if (!inView.current) {
|
|
||||||
checkInView();
|
|
||||||
}
|
|
||||||
}, 30);
|
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
checkInView();
|
checkInView();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user