23 lines
634 B
TypeScript
23 lines
634 B
TypeScript
import { useMemo } from 'react';
|
|
import type { UdbContext } from './UnifiedDataBar';
|
|
|
|
/**
|
|
* Build a UDL (Unified Data Layer) context from the current feature instance.
|
|
* Features use this to query scope-based data from the UDL
|
|
* instead of instance-scoped data silos.
|
|
*
|
|
* FeatureInstance -> UI-Scope (workflow surface)
|
|
* UDL -> Data-Scope (actual data access boundary)
|
|
*/
|
|
export function useUdlContext(
|
|
instanceId: string,
|
|
mandateId?: string,
|
|
userId?: string
|
|
): UdbContext {
|
|
return useMemo(() => ({
|
|
instanceId,
|
|
mandateId,
|
|
featureInstanceId: instanceId,
|
|
userId,
|
|
}), [instanceId, mandateId, userId]);
|
|
}
|