@@ -30,9 +30,6 @@ interface RecordDetailViewProps {
3030
3131const FALLBACK_USER = { id : 'current-user' , name : 'Demo User' } ;
3232
33- /** Field names automatically promoted to the highlight banner when present. */
34- const HIGHLIGHT_FIELD_NAMES = [ 'status' , 'stage' , 'priority' , 'category' , 'type' , 'owner' , 'amount' ] ;
35-
3633export function RecordDetailView ( { dataSource, objects, onEdit } : RecordDetailViewProps ) {
3734 const { objectName, recordId } = useParams ( ) ;
3835 const { showDebug } = useMetadataInspector ( ) ;
@@ -398,16 +395,8 @@ export function RecordDetailView({ dataSource, objects, onEdit }: RecordDetailVi
398395 } ) ;
399396 } ) ( ) ;
400397
401- // Build highlightFields: prefer explicit config, fallback to auto-detect key fields
402- const explicitHighlight : HighlightField [ ] | undefined = objectDef . views ?. detail ?. highlightFields ;
403- const highlightFields : HighlightField [ ] = explicitHighlight
404- ?? Object . entries ( objectDef . fields || { } )
405- . filter ( ( [ key ] : [ string , any ] ) => HIGHLIGHT_FIELD_NAMES . includes ( key ) )
406- . map ( ( [ key , def ] : [ string , any ] ) => ( {
407- name : key ,
408- label : def . label || key ,
409- ...( def . type && { type : def . type } ) ,
410- } ) ) ;
398+ // Build highlightFields: exclusively from objectDef metadata (no hardcoded fallback)
399+ const highlightFields : HighlightField [ ] = objectDef . views ?. detail ?. highlightFields ?? [ ] ;
411400
412401 // Build sectionGroups from objectDef detail/form config if available
413402 const sectionGroups : SectionGroup [ ] | undefined =
@@ -421,7 +410,7 @@ export function RecordDetailView({ dataSource, objects, onEdit }: RecordDetailVi
421410 data : childRelatedData [ childObject ] || [ ] ,
422411 } ) ) ;
423412
424- const detailSchema : DetailViewSchema = {
413+ const detailSchema : DetailViewSchema = useMemo ( ( ) => ( {
425414 type : 'detail-view' ,
426415 objectName : objectDef . name ,
427416 resourceId : pureRecordId ,
@@ -443,7 +432,7 @@ export function RecordDetailView({ dataSource, objects, onEdit }: RecordDetailVi
443432 actions : recordHeaderActions ,
444433 } as any ] ,
445434 } ) ,
446- } ;
435+ } ) , [ objectDef , pureRecordId , related , childRelatedData , actionRefreshKey ] ) ;
447436
448437 return (
449438 < div className = "h-full bg-background overflow-hidden flex flex-col relative" >
@@ -482,13 +471,14 @@ export function RecordDetailView({ dataSource, objects, onEdit }: RecordDetailVi
482471 < RecordChatterPanel
483472 config = { {
484473 position : 'bottom' ,
485- collapsible : false ,
474+ collapsible : true ,
486475 feed : {
487476 enableReactions : true ,
488477 enableThreading : true ,
489478 showCommentInput : true ,
490479 } ,
491480 } }
481+ collapseWhenEmpty
492482 items = { feedItems }
493483 onAddComment = { handleAddComment }
494484 onAddReply = { handleAddReply }
0 commit comments