From f9ddecbe67ae78cc1d6962e41f5ebbab9ca8874b Mon Sep 17 00:00:00 2001 From: ae_atrofimov Date: Fri, 4 Oct 2024 11:23:08 +0200 Subject: [PATCH] feat(ref): fix for init collapse state --- .../ParserOpenRPC/CollapseBox/CollapseBox.tsx | 10 ++++------ .../ParserOpenRPC/DetailsBox/RenderParams.tsx | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/components/ParserOpenRPC/CollapseBox/CollapseBox.tsx b/src/components/ParserOpenRPC/CollapseBox/CollapseBox.tsx index 0cb4a1e776..556d927c72 100644 --- a/src/components/ParserOpenRPC/CollapseBox/CollapseBox.tsx +++ b/src/components/ParserOpenRPC/CollapseBox/CollapseBox.tsx @@ -14,14 +14,12 @@ interface CollapseBoxProps { export const CollapseBox = ({ children, - isInitCollapsed = false, + isInitCollapsed = true, }: CollapseBoxProps) => { - const { collapsed, toggleCollapsed } = useCollapsible({ initialState: true }); + const { collapsed, setCollapsed } = useCollapsible({ initialState: isInitCollapsed }); const { colorMode } = useColorMode(); useEffect(() => { - if (isInitCollapsed) { - toggleCollapsed(); - } + setCollapsed(isInitCollapsed); }, [isInitCollapsed]); return (
setCollapsed((expanded) => !expanded)} > {collapsed ? "Show child attributes" : "Hide child attributes"}
{ description={item.description || item.title || ""} />
- + <> {Object.entries(item.properties).map(([key, value]) => (