fix: Gateway 화면에서 raw 프로필 ID 노출을 제거한다
불변 profileName은 라우팅과 저장 경계에 유지하고 사용자 출력은 공통 표시명을 사용한다. 기본 인스턴스 suffix를 숨기고 비기본 인스턴스만 사람이 읽을 수 있게 구분한다.
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import { directTrpc } from '../utils/trpc';
|
||||
|
||||
export type AdminProfileNavigationItem = {
|
||||
profileName: string;
|
||||
profile: string;
|
||||
instanceKey: string;
|
||||
displayName?: string;
|
||||
currentScenario: string | null;
|
||||
meta?: Record<string, unknown>;
|
||||
};
|
||||
|
||||
let cachedProfiles: AdminProfileNavigationItem[] | undefined;
|
||||
let cachedAt = 0;
|
||||
let inFlight: Promise<AdminProfileNavigationItem[]> | undefined;
|
||||
|
||||
export const loadAdminProfileNavigation = async (): Promise<AdminProfileNavigationItem[]> => {
|
||||
if (cachedProfiles && Date.now() - cachedAt < 5_000) return cachedProfiles;
|
||||
if (inFlight) return inFlight;
|
||||
inFlight = directTrpc.admin.profiles.listNavigation
|
||||
.query()
|
||||
.then((profiles) => {
|
||||
cachedProfiles = profiles as AdminProfileNavigationItem[];
|
||||
cachedAt = Date.now();
|
||||
return cachedProfiles;
|
||||
})
|
||||
.finally(() => {
|
||||
inFlight = undefined;
|
||||
});
|
||||
return inFlight;
|
||||
};
|
||||
Reference in New Issue
Block a user