Skip to content

Commit

Permalink
Set visible back to True for operator inputs upon removal of the outp…
Browse files Browse the repository at this point in the history
…ut (#534)

* Set visible back to True for operator inputs upon removal of the output

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
martinRenou and pre-commit-ci[bot] authored Oct 24, 2024
1 parent 27732d2 commit 32f897f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/base/src/panelview/objecttree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { v4 as uuid } from 'uuid';
import visibilitySvg from '../../style/icon/visibility.svg';
import visibilityOffSvg from '../../style/icon/visibilityOff.svg';
import { IControlPanelModel } from '../types';
import { setVisible } from '../commands';

const visibilityIcon = new LabIcon({
name: 'jupytercad:visibilityIcon',
Expand Down Expand Up @@ -98,7 +99,7 @@ interface IProps {

export const handleRemoveObject = (
objectId: string,
sharedModel: any,
sharedModel: IJupyterCadDoc,
syncSelected: () => void
): void => {
if (!sharedModel) {
Expand Down Expand Up @@ -130,7 +131,13 @@ export const handleRemoveObject = (
}).then(({ button: { accept } }) => {
if (accept) {
const toRemove = dependants.concat([objectId]);
sharedModel.removeObjects(toRemove);
const objetToRemove = sharedModel.getObjectByName(objectId);
sharedModel.transact(() => {
objetToRemove?.dependencies?.forEach((dependency: string) => {
setVisible(sharedModel, dependency, true);
});
sharedModel.removeObjects(toRemove);
});
}
});

Expand Down

0 comments on commit 32f897f

Please sign in to comment.