Skip to content

An error occurred when use useGroupRef #566

@ivyjiayugan-spec

Description

@ivyjiayugan-spec

I wanna resize each panel in V4, so I try to use the hook: useGroupRef. But it throw an error: Could not find Group with id ":r29:"

Image

Here's my usage:

import {
  Group,
  Panel,
  Separator,
  useGroupRef
} from 'react-resizable-panels';

 const groupRef = useGroupRef();

useEffect(() => {
    if (!isSplit) {      
      groupRef?.current?.setLayout({
        mainContent: 100,
        splitContent: 0,
      });
    }    
  }, [isSplit]); //  this 'isSplit' param is from props

<Group
   orientation="horizontal"
    groupRef={groupRef}
>
    <Panel id="mainContent">main</Panel>
    <Separator />
    <Panel id="splitContent">split</Panel>
</Group>

If there is any mistake in my usage or any problem, please let me know. Thank u ~

version: 4.0.16
react version: 18.3.1

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions