fix: Response Pane height context restore issue in some cases (#17750)
This commit is contained in:
parent
ddff993722
commit
ff15074f82
|
|
@ -1,6 +1,7 @@
|
||||||
import { Layers } from "constants/Layers";
|
import { Layers } from "constants/Layers";
|
||||||
import React, { useState, useEffect, RefObject } from "react";
|
import React, { useState, useEffect, RefObject } from "react";
|
||||||
import styled, { css } from "styled-components";
|
import styled, { css } from "styled-components";
|
||||||
|
import { ActionExecutionResizerHeight } from "pages/Editor/APIEditor/constants";
|
||||||
|
|
||||||
export const ResizerCSS = css`
|
export const ResizerCSS = css`
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
@ -30,15 +31,20 @@ type ResizerProps = {
|
||||||
function Resizer(props: ResizerProps) {
|
function Resizer(props: ResizerProps) {
|
||||||
const [mouseDown, setMouseDown] = useState(false);
|
const [mouseDown, setMouseDown] = useState(false);
|
||||||
const [height, setHeight] = useState(
|
const [height, setHeight] = useState(
|
||||||
props.panelRef.current?.getBoundingClientRect().height || 0,
|
props.initialHeight ||
|
||||||
|
props.panelRef.current?.getBoundingClientRect().height ||
|
||||||
|
ActionExecutionResizerHeight,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// On mount and update, set the initial height of the component
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!props.initialHeight) return;
|
if (!props.initialHeight) return;
|
||||||
const panel = props.panelRef.current;
|
const panel = props.panelRef.current;
|
||||||
if (!panel) return;
|
if (!panel) return;
|
||||||
panel.style.height = `${props.initialHeight}px`;
|
panel.style.height = `${props.initialHeight}px`;
|
||||||
setHeight(props.initialHeight);
|
if (height !== props.initialHeight) {
|
||||||
|
setHeight(props.initialHeight);
|
||||||
|
}
|
||||||
}, [props.initialHeight]);
|
}, [props.initialHeight]);
|
||||||
|
|
||||||
const handleResize = (movementY: number) => {
|
const handleResize = (movementY: number) => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user