fix mutual graph

This commit is contained in:
pa
2025-11-19 20:21:44 +09:00
committed by Natsumi
parent 243f5df597
commit 2256d2b9e8
3 changed files with 14 additions and 35 deletions
+4 -22
View File
@@ -75,7 +75,6 @@
const chartRef = ref(null);
let chartInstance = null;
let resizeObserver = null;
let lastRenderablePayload = null;
const isFetching = computed({
get: () => status.isFetching,
@@ -89,12 +88,6 @@
status.hasFetched = val;
}
});
const fetchError = computed({
get: () => status.fetchError,
set: (val) => {
status.fetchError = val;
}
});
const totalFriends = computed(() => friends.value.size);
const isOptOut = computed(() => Boolean(currentUser.value?.hasSharedConnectionsOptOut));
@@ -181,9 +174,9 @@
return;
}
chartInstance = echarts.init(chartRef.value, chartTheme.value, { useDirtyRect: totalFriends.value > 1000 });
if (lastRenderablePayload) {
updateChart(lastRenderablePayload);
} else if (graphReady.value) {
chartInstance.on('click', handleChartNodeClick);
if (graphReady.value) {
// @ts-ignore
updateChart(graphPayload.value);
}
@@ -286,7 +279,6 @@
}
isFetching.value = true;
fetchError.value = '';
status.completionNotified = false;
status.needsRefetch = false;
status.cancelRequested = false;
@@ -376,23 +368,13 @@
}
return;
}
lastRenderablePayload = payload;
if (!chartInstance) {
return;
}
chartInstance.setOption(createChartOption(payload), true);
registerChartEvents();
chartInstance.setOption(createChartOption(payload));
nextTick(() => chartInstance?.resize());
}
function registerChartEvents() {
if (!chartInstance) {
return;
}
chartInstance.off('click', handleChartNodeClick);
chartInstance.on('click', handleChartNodeClick);
}
function handleChartNodeClick(params) {
if (params?.dataType !== 'node') {
return;