Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions packages/plugins/apps/src/vite/execution-epoch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ export interface EpochScope {
export interface EpochGuard {
/** Starts a new scope, superseding whichever one was previously active. */
start(): EpochScope;
/** True if some started scope hasn't yet been concluded or superseded. */
hasActiveScope(): boolean;
/** Unconditionally invalidates the active scope without starting a new one — the backstop for a scope whose own `fn` never settles. */
forceInvalidate(): void;
}

export function createEpochGuard(): EpochGuard {
Expand All @@ -34,5 +38,11 @@ export function createEpochGuard(): EpochGuard {
},
};
},
hasActiveScope() {
return activeGeneration !== null;
},
forceInvalidate() {
activeGeneration = null;
},
};
}
Loading
Loading