Updates
This commit is contained in:
parent
dcd7f022bd
commit
c4c2caa6f0
@ -36,7 +36,10 @@ export default function ServiceClusterServerViews({
|
||||
const viewRef = useRef<HTMLDivElement>(undefined);
|
||||
|
||||
const { data } = useWebSocketEventHandler<WebSocketDataType>();
|
||||
const { isIntersecting } = useIntersectionObserver({ elementRef: viewRef });
|
||||
const { isIntersecting } = useIntersectionObserver({
|
||||
elementRef: viewRef,
|
||||
options: { rootMargin: "-200px", threshold: 0 },
|
||||
});
|
||||
|
||||
const [ttyd, setTtyd] = useState<TtydInfoObject>();
|
||||
|
||||
@ -56,7 +59,7 @@ export default function ServiceClusterServerViews({
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (!ws?.socket || WsReqSentRef.current) {
|
||||
if (!ws?.socket || WsReqSentRef.current || !isIntersecting) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -80,11 +83,9 @@ export default function ServiceClusterServerViews({
|
||||
return function () {
|
||||
sendKillPort();
|
||||
};
|
||||
}, [ws, refresh]);
|
||||
}, [ws, refresh, isIntersecting]);
|
||||
|
||||
useEffect(() => {
|
||||
console.log("log_cmd", log_cmd);
|
||||
|
||||
if (WsReqSentRef.current) {
|
||||
sendKillPort();
|
||||
|
||||
@ -125,7 +126,10 @@ export default function ServiceClusterServerViews({
|
||||
useEffect(() => {
|
||||
if (!ttyd?.port) return;
|
||||
|
||||
if (!isIntersecting) {
|
||||
if (isIntersecting) {
|
||||
WsReqSentRef.current = false;
|
||||
setTtyd(undefined);
|
||||
} else {
|
||||
sendKillPort();
|
||||
}
|
||||
}, [isIntersecting]);
|
||||
|
||||
@ -13,8 +13,6 @@ export default async function socketClientServiceServerLogs({
|
||||
const server = data?.server;
|
||||
const cmd = data?.cmd;
|
||||
|
||||
console.log("cmd", cmd);
|
||||
|
||||
const ttyd = await grabTtydServerInfo({
|
||||
server,
|
||||
service,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user