Skip to content

group.setVisible should not be publically exposed #923

Closed
@tearfulDalvik

Description

@tearfulDalvik

Describe the bug
setVisible(false) is not working

To Reproduce

import {
  DockviewReact,
  DockviewReadyEvent,
  IDockviewPanelProps,
} from 'dockview';
import React from 'react';

const Default = (props: IDockviewPanelProps) => {
  return <div>{props.api.title}</div>;
};

const components = {
  default: Default,
};

export default () => {
  const onReady = (event: DockviewReadyEvent) => {
    event.api.addGroup({
      id: 'group_1',
      direction: 'within',
    });

    event.api.addPanel({
      id: 'panel_1',
      component: 'default',
      position: {
        direction: 'within',
        referenceGroup: 'group_1',
      },
    });
    event.api.addGroup({
      id: "group_2",
      direction: 'within',
    })
    event.api.addPanel({
      id: 'panel_2',
      component: 'default',
      position: {
        direction: 'within',
        referenceGroup: 'group_2',
      },
    });
    event.api.getGroup("group_2").setVisible(false)
  };

  return (
    <DockviewReact
      className={'dockview-theme-abyss'}
      onReady={onReady}
      components={components}
    />
  );
};

Steps to reproduce the behavior:

  1. Use the code above
  2. The above code has event.api.getGroup("group_2").setVisible(false) in useEffect, but group_2 and panel_2 are still visible
  3. Manually call api.getGroup("group_2").setVisible(false) in console, still visible.

Expected behavior
group_2 to be invisible and dockview should re-layout

Additional context

 "dependencies": {
    "@testing-library/dom": "^10.4.0",
    "@testing-library/jest-dom": "^6.6.3",
    "@testing-library/react": "^16.3.0",
    "@testing-library/user-event": "^13.5.0",
    "dockview-react": "^4.2.5",
    "react": "^19.1.0",
    "react-dom": "^19.1.0",
    "react-scripts": "5.0.1",
    "web-vitals": "^2.1.4"
  },

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions