@@ -9,7 +9,7 @@ import { DEFAULT_EDGE_COLOR } from "../lib/consts";
99import { useNotifications } from "../lib/notifications" ;
1010
1111const EdgePanel : FC < { isExpanded : boolean } > = ( { isExpanded } ) => {
12- const { navState, setNavState, setShowEdgePanel, data, graphFile } = useContext ( GraphContext ) ;
12+ const { navState, setNavState, setShowEdgePanel, data, graphFile, computedData } = useContext ( GraphContext ) ;
1313 const { notify } = useNotifications ( ) ;
1414
1515 // State for edge creation criteria - use navState values if available, otherwise defaults
@@ -136,7 +136,10 @@ const EdgePanel: FC<{ isExpanded: boolean }> = ({ isExpanded }) => {
136136 if ( ! data || ! data . graph ) return ;
137137
138138 const { graph } = data ;
139- const nodes = graph . nodes ( ) ;
139+ // Use filtered nodes if available, otherwise use all nodes
140+ const nodes = computedData ?. filteredNodes ?
141+ Array . from ( computedData . filteredNodes ) :
142+ graph . nodes ( ) ;
140143 const edgesCreated : Array < { source : string ; target : string ; sharedTopics : string [ ] } > = [ ] ;
141144
142145 // Get all nodes with their topics and filter out nodes without topics
@@ -237,7 +240,10 @@ const EdgePanel: FC<{ isExpanded: boolean }> = ({ isExpanded }) => {
237240 if ( ! data || ! data . graph ) return ;
238241
239242 const { graph } = data ;
240- const nodes = graph . nodes ( ) ;
243+ // Use filtered nodes if available, otherwise use all nodes
244+ const nodes = computedData ?. filteredNodes ?
245+ Array . from ( computedData . filteredNodes ) :
246+ graph . nodes ( ) ;
241247 const edgesCreated : Array < { source : string ; target : string ; organization : string } > = [ ] ;
242248
243249 // Get all nodes with their organization (owner from nameWithOwner)
@@ -337,7 +343,10 @@ const EdgePanel: FC<{ isExpanded: boolean }> = ({ isExpanded }) => {
337343 if ( ! data || ! data . graph ) return [ ] ;
338344
339345 const { graph } = data ;
340- const nodes = graph . nodes ( ) ;
346+ // Use filtered nodes if available, otherwise use all nodes
347+ const nodes = computedData ?. filteredNodes ?
348+ Array . from ( computedData . filteredNodes ) :
349+ graph . nodes ( ) ;
341350
342351 // Debug: Log overall data structure
343352 console . log ( 'Graph data structure:' , data ) ;
@@ -455,7 +464,10 @@ const EdgePanel: FC<{ isExpanded: boolean }> = ({ isExpanded }) => {
455464 if ( ! data || ! data . graph ) return [ ] ;
456465
457466 const { graph } = data ;
458- const nodes = graph . nodes ( ) ;
467+ // Use filtered nodes if available, otherwise use all nodes
468+ const nodes = computedData ?. filteredNodes ?
469+ Array . from ( computedData . filteredNodes ) :
470+ graph . nodes ( ) ;
459471
460472 // Debug: Log overall data structure
461473 console . log ( 'Stargazer - Graph data structure:' , data ) ;
@@ -583,7 +595,10 @@ const EdgePanel: FC<{ isExpanded: boolean }> = ({ isExpanded }) => {
583595 edgeType : string ;
584596 } > = [ ] ;
585597
586- const nodes = graph . nodes ( ) ;
598+ // Use filtered nodes if available, otherwise use all nodes
599+ const nodes = computedData ?. filteredNodes ?
600+ Array . from ( computedData . filteredNodes ) :
601+ graph . nodes ( ) ;
587602 const processedPairs = new Set < string > ( ) ;
588603
589604 // Process all pairs of nodes
@@ -1104,6 +1119,12 @@ const EdgePanel: FC<{ isExpanded: boolean }> = ({ isExpanded }) => {
11041119
11051120 { /* Apply Button */ }
11061121 < div className = "mb-3" >
1122+ { computedData ?. filteredNodes && (
1123+ < div className = "alert alert-info small mb-3" >
1124+ < strong > Note:</ strong > Edge creation will only consider currently visible nodes ({ computedData . filteredNodes . size } of { data ?. graph ?. order || 0 } total).
1125+ Hidden/filtered nodes will not participate in edge creation.
1126+ </ div >
1127+ ) }
11071128 < button
11081129 className = "btn btn-light w-100 text-center"
11091130 onClick = { handleApplyEdgeCreation }
0 commit comments