|
|
@@ -18,7 +18,11 @@ import { fetchDisplayBuckets, fetchBucketMembers } from '../services/displayBuck
|
|
|
export function isDisplayBucketsEnabled() {
|
|
|
const globalFlag = typeof globalThis !== 'undefined' ? globalThis.__COCKPIT_DISPLAY_BUCKETS__ : undefined
|
|
|
const envFlag = import.meta && import.meta.env ? import.meta.env.VITE_COCKPIT_DISPLAY_BUCKETS : undefined
|
|
|
- return globalFlag === true || String(envFlag || '') === '1'
|
|
|
+ // 兼容开关的运行时覆盖:便于同条件 A/B 与回退演练,无需重启 dev server。
|
|
|
+ const queryFlag = typeof location !== 'undefined'
|
|
|
+ && typeof URLSearchParams !== 'undefined'
|
|
|
+ && new URLSearchParams(location.search).get('displayBuckets') === '1'
|
|
|
+ return globalFlag === true || String(envFlag || '') === '1' || queryFlag
|
|
|
}
|
|
|
|
|
|
export const useDisplayBucketStore = defineStore('displayBucketStore', () => {
|
|
|
@@ -101,7 +105,10 @@ export const useDisplayBucketStore = defineStore('displayBucketStore', () => {
|
|
|
activeFilters = filters || {}
|
|
|
activeSnapshotAt = nextSnapshotAt
|
|
|
const nextKey = [bbox, zoomBand, activeSnapshotAt, activeFilters.industry, activeFilters.scope, activeFilters.deviceType, (activeFilters.pointStatus || []).join(',')].join('|')
|
|
|
- if (nextKey === requestKey.value && phase.value === DISPLAY_BUCKET_PHASE.READY) return
|
|
|
+ // 视野/快照没变时不要用 900ms 轮询反复 abort 在途请求:
|
|
|
+ // 后端一次桶查询在真实数据下可能要 0.5–1s,abort 会让新路径永远停在 loading。
|
|
|
+ if (nextKey === requestKey.value
|
|
|
+ && (phase.value === DISPLAY_BUCKET_PHASE.READY || phase.value === DISPLAY_BUCKET_PHASE.LOADING)) return
|
|
|
requestKey.value = nextKey
|
|
|
phase.value = DISPLAY_BUCKET_PHASE.LOADING
|
|
|
reason.value = ''
|