Simplify interaction link deletion logic in App.tsx
This commit is contained in:
@@ -1609,17 +1609,8 @@ export function App({ store, initialStatusMessage }: AppProps) {
|
|||||||
|
|
||||||
const handleDeleteInteractionLink = (linkId: string) => {
|
const handleDeleteInteractionLink = (linkId: string) => {
|
||||||
try {
|
try {
|
||||||
const link = editorState.document.interactionLinks[linkId];
|
|
||||||
store.executeCommand(createDeleteInteractionLinkCommand(linkId));
|
store.executeCommand(createDeleteInteractionLinkCommand(linkId));
|
||||||
setStatusMessage("Deleted interaction link.");
|
setStatusMessage("Deleted interaction link.");
|
||||||
// Re-sync trigger volume flags after deletion
|
|
||||||
if (link !== undefined) {
|
|
||||||
const remainingLinks = getInteractionLinksForSource(
|
|
||||||
editorState.document.interactionLinks,
|
|
||||||
link.sourceEntityId
|
|
||||||
).filter((l) => l.id !== linkId);
|
|
||||||
syncTriggerVolumeFlags(link.sourceEntityId, remainingLinks);
|
|
||||||
}
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setStatusMessage(getErrorMessage(error));
|
setStatusMessage(getErrorMessage(error));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user