Fix duplicate api requuests for graph fetching
- Optimize graph data fetching conditions - Add isFetching state to prevent duplicate requests - Improve label selection handling
This commit is contained in:
@@ -57,8 +57,11 @@ const GraphLabels = () => {
|
||||
|
||||
const currentLabel = useSettingsStore.getState().queryLabel
|
||||
|
||||
// When selecting the same label (except '*'), switch to '*'
|
||||
if (newLabel === currentLabel && newLabel !== '*') {
|
||||
if (newLabel === '*' && currentLabel === '*') {
|
||||
// When reselecting '*', just set it again to trigger a new fetch
|
||||
useSettingsStore.getState().setQueryLabel('*')
|
||||
} else if (newLabel === currentLabel && newLabel !== '*') {
|
||||
// When selecting the same label (except '*'), switch to '*'
|
||||
useSettingsStore.getState().setQueryLabel('*')
|
||||
} else {
|
||||
useSettingsStore.getState().setQueryLabel(newLabel)
|
||||
|
Reference in New Issue
Block a user