| 1 | import type { ComposerInvocation } from "./invocationDisplay"; |
| 2 | |
| 3 | let nextID = 1; |
| 4 | export function newComposerInvocationID(invocations: ComposerInvocation[]): string { |
| 5 | // Persisted inputs can contain IDs allocated by a previous renderer. |
| 6 | let id: string; |
| 7 | do { id = `invocation-${nextID++}`; } |
| 8 | while (invocations.some(item => item.id === id)); |
| 9 | return id; |
| 10 | } |
| 11 |