debug: add step-by-step logging in loadCalendarData to trace where error occurs

This commit is contained in:
2026-06-08 12:23:51 +08:00
parent 5069472e19
commit 35e23d75fa
4 changed files with 16 additions and 10 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -19,7 +19,7 @@
background: #13131f; background: #13131f;
} }
</style> </style>
<script type="module" crossorigin src="/assets/main-OHW3omcP.js"></script> <script type="module" crossorigin src="/assets/main-C0ZuLxdW.js"></script>
<link rel="stylesheet" crossorigin href="/assets/main-B1PBee3I.css"> <link rel="stylesheet" crossorigin href="/assets/main-B1PBee3I.css">
</head> </head>
<body> <body>
+10 -4
View File
@@ -85,16 +85,22 @@
// Load events + categories from Lua backend and send to iframe // Load events + categories from Lua backend and send to iframe
async function loadCalendarData() { async function loadCalendarData() {
try { try {
console.log('[CalendarPluginPage] loadCalendarData: step 1')
const now = new Date() const now = new Date()
const year = now.getFullYear() const year = now.getFullYear()
const month = now.getMonth() const month = now.getMonth()
const start = new Date(year, month, 1).toISOString().slice(0, 10) + 'T00:00:00' const start = new Date(year, month, 1).toISOString().slice(0, 10) + 'T00:00:00'
const end = new Date(year, month + 1, 0).toISOString().slice(0, 10) + 'T23:59:59' const end = new Date(year, month + 1, 0).toISOString().slice(0, 10) + 'T23:59:59'
console.log('[CalendarPluginPage] loadCalendarData: step 2, start=' + start + ', end=' + end)
const [eventsRaw, categoriesRaw] = await Promise.all([ console.log('[CalendarPluginPage] loadCalendarData: step 3, calling get_events...')
wailsCall('CallPluginFunction', pluginName, funcPrefix + 'get_events', JSON.stringify({ start, end })), const eventsPromise = wailsCall('CallPluginFunction', pluginName, funcPrefix + 'get_events', JSON.stringify({ start, end }))
wailsCall('CallPluginFunction', pluginName, funcPrefix + 'get_categories', '{}'), console.log('[CalendarPluginPage] loadCalendarData: step 4, calling get_categories...')
]) const categoriesPromise = wailsCall('CallPluginFunction', pluginName, funcPrefix + 'get_categories', '{}')
console.log('[CalendarPluginPage] loadCalendarData: step 5, awaiting Promise.all...')
const [eventsRaw, categoriesRaw] = await Promise.all([eventsPromise, categoriesPromise])
console.log('[CalendarPluginPage] loadCalendarData: step 6, got results, eventsRaw=' + typeof eventsRaw + ', categoriesRaw=' + typeof categoriesRaw)
const events = eventsRaw ? JSON.parse(eventsRaw) : [] const events = eventsRaw ? JSON.parse(eventsRaw) : []
const categories = categoriesRaw ? JSON.parse(categoriesRaw) : [] const categories = categoriesRaw ? JSON.parse(categoriesRaw) : []