From 8d7b9654181f59f4835d100b2a63d2cf5d3e745a Mon Sep 17 00:00:00 2001 From: Bhanu Prakash Sai Potteri Date: Sat, 23 May 2026 17:03:07 +0530 Subject: [PATCH] RV: prefilter by current_state_id; hide UUID column client-side --- src/config.ts | 11 +++++++++++ src/hooks/usePrototypeData.ts | 5 +++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/config.ts b/src/config.ts index e90c8e5..7119d19 100644 --- a/src/config.ts +++ b/src/config.ts @@ -25,6 +25,17 @@ export const RECORD_VIEW_IDS = { SCHEDULED_TEST_DRIVES: "rv-mahindra-scheduled-td", } as const; +// rv_uid -> field_keys that should NOT render as table columns even though +// they're declared on the RV. current_state_id lives on these RVs only so the +// server-side prefilter validator accepts it; the rendered table doesn't need +// the raw UUID column. +export const RV_HIDDEN_COLUMNS: Record = { + "rv-mahindra-active-scheduling": ["current_state_id"], + "rv-mahindra-scheduled-td": ["current_state_id"], + "rv-mahindra-pending-feedback": ["current_state_id"], + "rv-mahindra-completed": ["current_state_id"], +}; + export const DETAIL_VIEW_IDS = { INSTANCE_DETAIL: "7865e1d9-9f7c-489e-a12b-98463ebbb5c1", } as const; diff --git a/src/hooks/usePrototypeData.ts b/src/hooks/usePrototypeData.ts index 1f84a94..29d700d 100644 --- a/src/hooks/usePrototypeData.ts +++ b/src/hooks/usePrototypeData.ts @@ -9,7 +9,7 @@ import { type SearchQuery, type TileValue, type ChartDataResponse, type AuditEntry, } from "../api/viewService"; -import { WORKFLOW_ID } from "../config"; +import { WORKFLOW_ID, RV_HIDDEN_COLUMNS } from "../config"; // --------------------------------------------------------------------------- // rv-screen layout walkers (same logic the production RecordViewTable uses; @@ -241,7 +241,8 @@ export function useRecordView(viewId: number | string | null): UseRecordViewStat const res = await getRecordView(rvTemplateUid, viewId, query); setTileValues(res.tile_values ?? []); setChartData(res.chart_data ?? []); - setFields(res.config.fields.filter((f) => f.field_key !== "")); + const hidden = new Set(RV_HIDDEN_COLUMNS[rvTemplateUid] ?? []); + setFields(res.config.fields.filter((f) => f.field_key !== "" && !hidden.has(f.field_key))); const dataRows = Array.isArray(res.data) ? res.data : []; setRows(dataRows); if (res.pagination) setPagination(res.pagination);