@@ -51,12 +51,9 @@ export function createMermaidDiagram( |
51 | 51 |
|
52 | 52 | const lines: string[] = []; |
53 | 53 | const errorFocus = getStateErrorFocus(sm); |
54 | | - // when the call's condition here names another state set whose state rejects it, |
55 | | - // the call is drawn as usual and that condition is marked instead |
| 54 | + // when a transition of the call needs a state of another state set whose state rejects it, |
| 55 | + // it is drawn as usual and that condition is marked instead |
56 | 56 | const rejectingStateSets = getRejectingStateSets(sm, stateSets); |
57 | | - const isUnmet = (transition: LJStateMachine['transitions'][number]) => |
58 | | - hasUnmetCondition(transition, sm, stateSets, rejectingStateSets); |
59 | | - const hasUnmetCall = sm.transitions.some(isUnmet); |
60 | 57 | const relatedStates = focusOnError && errorFocus ? getRelatedStates(errorFocus) : []; |
61 | 58 | const isDimmed = (state: string) => relatedStates.length > 0 && !relatedStates.includes(state); |
62 | 59 | // focusing collapses the dimmed methods of each label, so the diagram is laid out again around the error |
@@ -119,12 +116,13 @@ export function createMermaidDiagram( |
119 | 116 | const isCalledMethod = transition.label === sm.errorContext?.calledMethod; |
120 | 117 | // in focus mode, only the failed method stays bright |
121 | 118 | const dimmed = collapse && !isCalledMethod; |
| 119 | + const unmet = hasUnmetCondition(transition, sm, stateSets, rejectingStateSets); |
122 | 120 | const label = getTransitionLabel( |
123 | 121 | transition.label, |
124 | | - getFromConditionLabel(transition.fromCondition, stateSets, isUnmet(transition) ? rejectingStateSets : null, showConditions), |
| 122 | + getFromConditionLabel(transition.fromCondition, stateSets, unmet ? rejectingStateSets : null, showConditions), |
125 | 123 | transition.toCondition, |
126 | 124 | showConditions, |
127 | | - isCalledMethod && !hasUnmetCall, |
| 125 | + isCalledMethod && !unmet, |
128 | 126 | ); |
129 | 127 | if (!transitionMap.has(key)) transitionMap.set(key, { bright: [], dimmed: [] }); |
130 | 128 | const group = transitionMap.get(key)!; |
|