feat(tracking): pass question hash/text via history state and follow URL business date
Frontend CI / Frontend (push) Successful in 3m11s

Move question_hash and question_text out of the URL query into router
history state to keep tracking question links clean, and make the
tracking dashboard's business date follow the URL/today instead of the
previously persisted localStorage value.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-24 00:27:32 +08:00
parent 0d690371d2
commit 075e282c76
2 changed files with 22 additions and 13 deletions
@@ -30,8 +30,16 @@ const trackingToday = dayjs().format('YYYY-MM-DD')
const routeBrandId = computed(() => parsePositiveNumber(route.params.brandId))
const brandId = computed(() => companyStore.currentBrandId ?? routeBrandId.value)
const questionId = computed(() => parsePositiveNumber(route.params.questionId))
const questionHash = computed(() => normalizeQueryValue(route.query.question_hash))
const questionTitleFallback = computed(() => normalizeQueryValue(route.query.question_text))
const questionHash = computed(
() =>
normalizeHistoryStateValue(history.state?.tracking_question_hash) ||
normalizeQueryValue(route.query.question_hash),
)
const questionTitleFallback = computed(
() =>
normalizeHistoryStateValue(history.state?.tracking_question_text) ||
normalizeQueryValue(route.query.question_text),
)
const keywordId = computed(() => normalizeQueryValue(route.query.keyword_id))
const requestedPlatformId = computed(() => {
const platformId = normalizeMonitoringPlatformId(normalizeQueryValue(route.query.ai_platform_id))
@@ -1086,6 +1094,10 @@ function normalizeQueryValue(value: unknown): string {
return String(raw ?? '').trim()
}
function normalizeHistoryStateValue(value: unknown): string {
return typeof value === 'string' ? value.trim() : ''
}
function normalizeTrackingBusinessDate(value: unknown): string | null {
const normalized = normalizeQueryValue(value)
if (!normalized) {