Skip graph creation if no data or empty nodes
- Add log for skipped graph creation
This commit is contained in:
parent
20de4ded30
commit
3279948dcd
1 changed files with 8 additions and 2 deletions
|
|
@ -141,7 +141,13 @@ const fetchGraph = async (label: string, maxDepth: number, minDegree: number) =>
|
||||||
|
|
||||||
// Create a new graph instance with the raw graph data
|
// Create a new graph instance with the raw graph data
|
||||||
const createSigmaGraph = (rawGraph: RawGraph | null) => {
|
const createSigmaGraph = (rawGraph: RawGraph | null) => {
|
||||||
// Always create a new graph instance
|
// Skip graph creation if no data or empty nodes
|
||||||
|
if (!rawGraph || !rawGraph.nodes.length) {
|
||||||
|
console.log('No graph data available, skipping sigma graph creation');
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create new graph instance
|
||||||
const graph = new DirectedGraph()
|
const graph = new DirectedGraph()
|
||||||
|
|
||||||
// Add nodes from raw graph data
|
// Add nodes from raw graph data
|
||||||
|
|
@ -242,7 +248,7 @@ const useLightrangeGraph = () => {
|
||||||
if (!isFetching && !fetchInProgressRef.current &&
|
if (!isFetching && !fetchInProgressRef.current &&
|
||||||
(paramsChanged || !useGraphStore.getState().graphDataFetchAttempted)) {
|
(paramsChanged || !useGraphStore.getState().graphDataFetchAttempted)) {
|
||||||
|
|
||||||
// Only fetch data if the Graph tab is visible
|
// Only fetch data if the Graph tab is visible and we haven't attempted a fetch yet
|
||||||
if (!isGraphTabVisible) {
|
if (!isGraphTabVisible) {
|
||||||
console.log('Graph tab not visible, skipping data fetch');
|
console.log('Graph tab not visible, skipping data fetch');
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue