|
@@ -9,7 +9,7 @@ import BaseComponent from "../_base/baseComponent";
|
|
|
import PropTypes from "prop-types";
|
|
|
import cls from "classnames";
|
|
|
import { cssClasses } from "@douyinfe/semi-foundation/collapsible/constants";
|
|
|
-import { isEqual } from "lodash";
|
|
|
+import { isEqual, omit, pick } from "lodash";
|
|
|
import "@douyinfe/semi-foundation/collapsible/collapsible.scss";
|
|
|
import { getDefaultPropsFromGlobalConfig } from "../_utils";
|
|
|
|
|
@@ -123,8 +123,8 @@ class Collapsible extends BaseComponent<CollapsibleProps, CollapsibleState> {
|
|
|
}
|
|
|
|
|
|
componentDidUpdate(prevProps: Readonly<CollapsibleProps>, prevState: Readonly<CollapsibleState>, snapshot?: any) {
|
|
|
- const changedPropKeys = Object.keys(this.props).filter(key => !isEqual(this.props[key], prevProps[key]));
|
|
|
- const changedStateKeys = Object.keys(this.state).filter(key => !isEqual(this.state[key], prevState[key]));
|
|
|
+ const changedPropKeys = Object.keys(pick(this.props, ['reCalcKey', "isOpen"])).filter(key => !isEqual(this.props[key], prevProps[key]));
|
|
|
+ const changedStateKeys = Object.keys(pick(this.state, ['domInRenderTree'])).filter(key => !isEqual(this.state[key], prevState[key]));
|
|
|
if (changedPropKeys.includes("reCalcKey")) {
|
|
|
this.foundation.updateDOMHeight(this.domRef.current.scrollHeight);
|
|
|
}
|