Skip to content

Commit 1c4b082

Browse files
committed
docs(mfa): explain why the xstate prefix identifies auto-driven events
1 parent 2f3ea7f commit 1c4b082

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

tests/utils/mfa/flowPaths.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@ type PathSteps = ReadonlyArray<{event: {type: string}}>;
113113

114114
type MfaSnapshot = SnapshotFrom<typeof mfaMachine>;
115115

116+
/**
117+
* Tells whether this event happens without a user gesture. Every event that XState synthesizes,
118+
* such as actor completion or a delayed transition firing, carries the `xstate.` prefix, and none
119+
* of them corresponds to a gesture, so the prefix check matches exactly the framework events.
120+
*/
116121
function isAutoDrivenEvent(eventType: string): boolean {
117122
return eventType.startsWith('xstate.');
118123
}

0 commit comments

Comments
 (0)