feat(tracking): pass question hash/text via history state and follow URL business date
Frontend CI / Frontend (push) Successful in 3m11s
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:
@@ -101,12 +101,12 @@ const allQuestionOptionValue = 'all'
|
||||
|
||||
const selectedQuestionId = useStorage<number | null>('tracking_selected_question', null)
|
||||
const selectedPlatformId = useStorage<string>('tracking_selected_ai_platform_id', 'all')
|
||||
const selectedBusinessDate = useStorage<string>('tracking_selected_business_date', trackingToday)
|
||||
const selectedBusinessDate = ref<string>(
|
||||
normalizeTrackingBusinessDate(route.query.business_date) ?? trackingToday,
|
||||
)
|
||||
const selectedCitationWindowDays = useStorage<number>('tracking_selected_citation_window_days', 7)
|
||||
|
||||
selectedPlatformId.value = normalizeMonitoringPlatformFilter(selectedPlatformId.value)
|
||||
selectedBusinessDate.value =
|
||||
normalizeTrackingBusinessDate(selectedBusinessDate.value) ?? trackingToday
|
||||
selectedCitationWindowDays.value = normalizeCitationWindowDays(selectedCitationWindowDays.value)
|
||||
|
||||
const selectedQuestionSetOptionValue = computed<string | number>({
|
||||
@@ -168,10 +168,7 @@ watch(selectedBrandId, (newId, oldId) => {
|
||||
watch(
|
||||
() => route.query.business_date,
|
||||
(value) => {
|
||||
const requestedBusinessDate = normalizeTrackingBusinessDate(value)
|
||||
if (requestedBusinessDate) {
|
||||
selectedBusinessDate.value = requestedBusinessDate
|
||||
}
|
||||
selectedBusinessDate.value = normalizeTrackingBusinessDate(value) ?? trackingToday
|
||||
},
|
||||
{ immediate: true },
|
||||
)
|
||||
@@ -636,13 +633,13 @@ function openQuestion(question: MonitoringHotQuestion): void {
|
||||
questionId: String(question.question_id),
|
||||
},
|
||||
query: {
|
||||
question_hash: question.question_hash,
|
||||
question_text: question.question_text,
|
||||
business_date: selectedBusinessDate.value,
|
||||
date_from: selectedBusinessDate.value,
|
||||
date_to: selectedBusinessDate.value,
|
||||
...(selectedPlatformId.value !== 'all' ? { ai_platform_id: selectedPlatformId.value } : {}),
|
||||
},
|
||||
state: {
|
||||
tracking_question_hash: question.question_hash,
|
||||
tracking_question_text: question.question_text,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user