14 lines
386 B
TypeScript
14 lines
386 B
TypeScript
/** Component-memory only. Identical retries retain their key; every changed submission gets a new one. */
|
|
export function retryIdentity() {
|
|
let previous: string | undefined
|
|
let key: string
|
|
return (payload: unknown): string => {
|
|
const next = JSON.stringify(payload)
|
|
if (next !== previous) {
|
|
previous = next
|
|
key = crypto.randomUUID()
|
|
}
|
|
return key
|
|
}
|
|
}
|