Просмотр исходного кода

fix: write the logs calendar month into the URL when it is missing

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jamesread 1 день назад
Родитель
Сommit
a8845b80fb
1 измененных файлов с 10 добавлено и 0 удалено
  1. 10 0
      frontend/resources/vue/views/LogsCalendarView.vue

+ 10 - 0
frontend/resources/vue/views/LogsCalendarView.vue

@@ -171,7 +171,17 @@ function handleMonthChange (month, year) {
   router.replace({ query: { ...route.query, month: formatCalendarMonthQuery(month, year) } })
 }
 
+// A missing or invalid month is written into the URL, so that bookmarking the
+// page keeps the month it showed.
+function writeDisplayedMonthToAddress () {
+  const month = formatCalendarMonthQuery(currentMonthIndex.value, currentYear.value)
+  if (route.query.month !== month) {
+    router.replace({ query: { ...route.query, month } })
+  }
+}
+
 onMounted(() => {
+  writeDisplayedMonthToAddress()
   fetchLogs()
 })
 </script>