@@ -182,9 +182,9 @@ export function DataRoomMarketplaceCard({
182182 }
183183 } ;
184184
185- // Fetch center node info from the graph
185+ // Fetch center node info by UUID (direct lookup, no delve query)
186186 const fetchCenterNodeInfo = async ( ) => {
187- if ( ! dataroom . center_node_uuid || ! dataroom . bonfire_id ) return ;
187+ if ( ! dataroom . center_node_uuid ) return ;
188188
189189 // Abort any existing request
190190 if ( centerNodeAbortRef . current ) {
@@ -195,39 +195,35 @@ export function DataRoomMarketplaceCard({
195195 setCenterNodeLoading ( true ) ;
196196
197197 try {
198- const response = await fetch ( `/api/bonfires/${ dataroom . bonfire_id } /preview` , {
199- method : "POST" ,
198+ // Direct entity lookup by UUID - much cheaper than delve
199+ const url = new URL ( `/api/knowledge_graph/entity/${ dataroom . center_node_uuid } ` , window . location . origin ) ;
200+ if ( dataroom . bonfire_id ) {
201+ url . searchParams . append ( "bonfire_id" , dataroom . bonfire_id ) ;
202+ }
203+
204+ const response = await fetch ( url . toString ( ) , {
205+ method : "GET" ,
200206 headers : { "Content-Type" : "application/json" } ,
201- body : JSON . stringify ( {
202- query : "" ,
203- num_results : 10 ,
204- center_node_uuid : dataroom . center_node_uuid ,
205- } ) ,
206207 signal : centerNodeAbortRef . current . signal ,
207208 } ) ;
208209
209210 if ( ! response . ok ) {
210211 throw new Error ( `Failed to fetch center node: ${ response . statusText } ` ) ;
211212 }
212213
213- const data = await response . json ( ) ;
214+ const entity = await response . json ( ) ;
214215
215- // Find the center node in the returned entities by matching UUID
216- const centerNode = ( data . entities || [ ] ) . find (
217- ( entity : any ) => entity . uuid === dataroom . center_node_uuid || entity . id === dataroom . center_node_uuid ,
218- ) ;
219-
220- if ( centerNode ) {
216+ if ( entity ) {
221217 setCenterNodeInfo ( {
222- uuid : centerNode . uuid || centerNode . id ,
223- name : centerNode . name || "Unknown Node" ,
224- entity_type : centerNode . entity_type || centerNode . type ,
225- summary : centerNode . summary || centerNode . description ,
226- labels : centerNode . labels ,
218+ uuid : entity . uuid || entity . id || dataroom . center_node_uuid ,
219+ name : entity . name || "Unknown Node" ,
220+ entity_type : entity . entity_type || entity . type || "unknown" ,
221+ summary : entity . summary || entity . description || "" ,
222+ labels : entity . labels || [ ] ,
227223 } ) ;
228224 }
229- } catch ( err : any ) {
230- if ( err . name === "AbortError" ) return ;
225+ } catch ( err : unknown ) {
226+ if ( err instanceof Error && err . name === "AbortError" ) return ;
231227 console . error ( "Failed to fetch center node info:" , err ) ;
232228 } finally {
233229 setCenterNodeLoading ( false ) ;
@@ -251,13 +247,13 @@ export function DataRoomMarketplaceCard({
251247 }
252248 } ;
253249
254- // Fetch center node info on mount if center_node_uuid exists
250+ // Fetch center node info only when preview is expanded (not on mount)
255251 useEffect ( ( ) => {
256- if ( dataroom . center_node_uuid && ! centerNodeInfo ) {
252+ if ( isPreviewExpanded && dataroom . center_node_uuid && ! centerNodeInfo && ! centerNodeLoading ) {
257253 fetchCenterNodeInfo ( ) ;
258254 }
259255 // eslint-disable-next-line react-hooks/exhaustive-deps
260- } , [ dataroom . center_node_uuid ] ) ;
256+ } , [ isPreviewExpanded , dataroom . center_node_uuid ] ) ;
261257
262258 // Cleanup on unmount
263259 useEffect ( ( ) => {
0 commit comments