Skip to content

Commit 32f897f

Browse files
Set visible back to True for operator inputs upon removal of the output (#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>
1 parent 27732d2 commit 32f897f

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

packages/base/src/panelview/objecttree.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import { v4 as uuid } from 'uuid';
2929
import visibilitySvg from '../../style/icon/visibility.svg';
3030
import visibilityOffSvg from '../../style/icon/visibilityOff.svg';
3131
import { IControlPanelModel } from '../types';
32+
import { setVisible } from '../commands';
3233

3334
const visibilityIcon = new LabIcon({
3435
name: 'jupytercad:visibilityIcon',
@@ -98,7 +99,7 @@ interface IProps {
9899

99100
export const handleRemoveObject = (
100101
objectId: string,
101-
sharedModel: any,
102+
sharedModel: IJupyterCadDoc,
102103
syncSelected: () => void
103104
): void => {
104105
if (!sharedModel) {
@@ -130,7 +131,13 @@ export const handleRemoveObject = (
130131
}).then(({ button: { accept } }) => {
131132
if (accept) {
132133
const toRemove = dependants.concat([objectId]);
133-
sharedModel.removeObjects(toRemove);
134+
const objetToRemove = sharedModel.getObjectByName(objectId);
135+
sharedModel.transact(() => {
136+
objetToRemove?.dependencies?.forEach((dependency: string) => {
137+
setVisible(sharedModel, dependency, true);
138+
});
139+
sharedModel.removeObjects(toRemove);
140+
});
134141
}
135142
});
136143

0 commit comments

Comments
 (0)