v1.0.50: add diagnostic logging for the update-refresh flow

No functional change. Adds streamDeck.logger.info() calls at
onPropertyInspectorDidAppear, sendProjectsToPI(), and onSendToPlugin
entry, plus a small on-panel debug trail (property-inspector.html)
that timestamps $PI.onConnected firings, button clicks, poll sends,
and received payloads. v1.0.49's panel-polling fix didn't visibly
work in testing and produced no status text at all on the second
attempt -- need to see the actual event sequence rather than guess
again. Remove once the refresh flow is confirmed working.
This commit is contained in:
pdmarf
2026-09-02 11:46:08 +01:00
parent acf4f98d6b
commit feed18ed0d
6 changed files with 30 additions and 6 deletions
+7 -2
View File
@@ -1,4 +1,4 @@
const CURRENT_VERSION = "1.0.49";
const CURRENT_VERSION = "1.0.50";
const GITEA_BASE = "https://gitea.pdmarf.co.uk/pdm/stream_deck_notion_timer/raw/branch/stable-rebuild";
const SIGNING_PUBLIC_KEY = `-----BEGIN PUBLIC KEY-----
MCowBQYDK2VwAyEAN7ko8TUpuPzPAJuKAZCRjV0c4ZSlou5d9pUAF6o12b4=
@@ -140,10 +140,12 @@ function setRunningEntry(entryId: string | null, actionId: string | null): void
}
async function sendProjectsToPI(tokenOverride?: string): Promise<void> {
streamDeck.logger.info(`[diag] sendProjectsToPI called, version=${CURRENT_VERSION}, hasToken=${!!tokenOverride}`);
try {
const global = await getGlobal();
const token = tokenOverride ?? global.notionToken;
if (!token) {
streamDeck.logger.info("[diag] sendProjectsToPI: no token, sending error payload");
await streamDeck.ui.sendToPropertyInspector({ event: "projects", data: [], error: "Enter your Notion API token above.", version: CURRENT_VERSION });
return;
}
@@ -155,6 +157,7 @@ async function sendProjectsToPI(tokenOverride?: string): Promise<void> {
}),
]);
await streamDeck.ui.sendToPropertyInspector({ event: "projects", data: projects, users: usersResult, version: CURRENT_VERSION });
streamDeck.logger.info(`[diag] sendProjectsToPI: sent projects payload, version=${CURRENT_VERSION}`);
} catch (err) {
streamDeck.logger.error("Failed to fetch projects:", err);
await streamDeck.ui.sendToPropertyInspector({ event: "projects", data: [], error: String(err), version: CURRENT_VERSION });
@@ -240,7 +243,8 @@ class TimerToggle extends SingletonAction<TimerSettings> {
}
}
async onPropertyInspectorDidAppear(_ev: PropertyInspectorDidAppearEvent<TimerSettings>): Promise<void> {
async onPropertyInspectorDidAppear(ev: PropertyInspectorDidAppearEvent<TimerSettings>): Promise<void> {
streamDeck.logger.info(`[diag] onPropertyInspectorDidAppear fired for ${ev.action.id}, version=${CURRENT_VERSION}`);
await sendProjectsToPI();
}
@@ -337,6 +341,7 @@ const timerAction = new TimerToggle();
streamDeck.actions.registerAction(timerAction);
streamDeck.ui.onSendToPlugin<{ event: string; settings?: TimerSettings; token?: string }>(async (ev) => {
streamDeck.logger.info(`[diag] onSendToPlugin received event=${ev.payload.event}, version=${CURRENT_VERSION}`);
if (ev.payload.event === "saveSettings" && ev.payload.settings) {
await ev.action.setSettings(ev.payload.settings);
const title = buttonTitle(ev.payload.settings.projectName || "");