Files
HealthLog/src/lib/record-settings/response.ts
T
Marc-André Bombeck e788675b82 feat: configure managed record settings
- Scope writable settings to the selected managed record\n- Render typed Guardian controls with separated audit attribution
2026-08-06 03:21:02 +02:00

15 lines
591 B
TypeScript

/**
* A request carries its active record through the session cookie, so the
* client must still reject a response that arrives after a tab switched to a
* different record. TanStack keys prevent cache aliasing; this closes the
* in-flight response race before it can populate that key.
*/
export function assertRecordSettingsResponseForRecord(
response: { recordId: string },
expectedRecordId: string | null,
): void {
if (expectedRecordId === null || response.recordId !== expectedRecordId) {
throw new Error("Managed record settings response did not match its key");
}
}