Do not throw when no selected not found (#13727)

<img width="1299" height="713" alt="Capture d’écran 2025-08-07 à 15 25
23"
src="https://github.com/user-attachments/assets/b9c3c3d3-9521-442a-8493-54a06418ade0"
/>

Remove error from console. When deleting a step, we get the command menu
opened for a short time. We should simply return null until the command
menu gets closed

Fix
https://twenty-v7.sentry.io/issues/6795046867/?project=4507072563183616&referrer=github-open-pr-bot
This commit is contained in:
Thomas Trompette
2025-08-07 16:17:52 +02:00
committed by GitHub
parent 0822080105
commit 3e1c9295d9
5 changed files with 33 additions and 30 deletions
@@ -1,17 +0,0 @@
import { useRecoilComponentValue } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValue';
import { workflowSelectedNodeComponentState } from '@/workflow/workflow-diagram/states/workflowSelectedNodeComponentState';
import { isDefined } from 'twenty-shared/utils';
export const useWorkflowSelectedNodeOrThrow = () => {
const workflowSelectedNode = useRecoilComponentValue(
workflowSelectedNodeComponentState,
);
if (!isDefined(workflowSelectedNode)) {
throw new Error(
'Expected a node to be selected. A node must have been selected before running this code.',
);
}
return workflowSelectedNode;
};