mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-09 04:50:59 +00:00
- Scope writable settings to the selected managed record\n- Render typed Guardian controls with separated audit attribution
15 lines
591 B
TypeScript
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");
|
|
}
|
|
}
|