Skip to content

Commit bc27faf

Browse files
committed
edge creation for filtered
1 parent fc15f04 commit bc27faf

File tree

2 files changed

+30
-9
lines changed

2 files changed

+30
-9
lines changed

src/components/TopicRefiner.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ export const TopicRefiner: FC<Omit<TopicRefinerProps, 'isLlmProcessing'>> = ({
129129
const data = await response.json();
130130
if (data.success) {
131131
setUniqueReposCount(data.count);
132-
console.log('Unique repos count updated:', data.count);
132+
// console.log('Unique repos count updated:', data.count);
133133
} else {
134134
throw new Error(data.message || 'Failed to get unique repos count');
135135
}
@@ -148,7 +148,7 @@ export const TopicRefiner: FC<Omit<TopicRefinerProps, 'isLlmProcessing'>> = ({
148148

149149
// Update unique repos count when finalized topics change
150150
useEffect(() => {
151-
console.log('Finalized topics changed, fetching unique repos count:', finalizedTopics);
151+
// console.log('Finalized topics changed, fetching unique repos count:', finalizedTopics);
152152
fetchUniqueReposCount(finalizedTopics);
153153
}, [finalizedTopics]);
154154

@@ -514,7 +514,7 @@ export const TopicRefiner: FC<Omit<TopicRefinerProps, 'isLlmProcessing'>> = ({
514514
return;
515515
}
516516

517-
console.log('Proceeding with submission, unique count:', uniqueReposCount);
517+
// console.log('Proceeding with submission, unique count:', uniqueReposCount);
518518
await submitTopics();
519519
};
520520

src/views/EdgePanel.tsx

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { DEFAULT_EDGE_COLOR } from "../lib/consts";
99
import { useNotifications } from "../lib/notifications";
1010

1111
const 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

Comments
 (0)