v1.0.51: stop chasing auto-refresh, tell the user to confirm manually instead
v1.0.49's panel-polling approach and v1.0.50's diagnostic logging did not produce a working auto-refresh in testing -- the panel still hung after the restarting message until a different button was clicked. Rather than keep guessing at Stream Deck's PI-reconnect lifecycle, removed the polling/debug scaffolding entirely and changed the final status message to explicitly instruct the user: 'Updated to vX. Click any other button above to confirm version update has been successful.'
This commit is contained in:
@@ -147,7 +147,6 @@
|
||||
<p id="versionText"></p>
|
||||
<button id="updateBtn">Check for Updates</button>
|
||||
<p id="updateStatus"></p>
|
||||
<p id="debugText" style="font-size:9px;color:#555;text-align:center;margin-top:4px;white-space:pre-line;"></p>
|
||||
|
||||
<script src="libs/constants.js"></script>
|
||||
<script src="libs/prototypes.js"></script>
|
||||
@@ -177,31 +176,6 @@
|
||||
el.className = cls || "";
|
||||
}
|
||||
|
||||
// TEMP diagnostic trail — remove once the update-refresh flow is confirmed working.
|
||||
var debugLines = [];
|
||||
function debugLog(msg) {
|
||||
var t = new Date().toISOString().slice(11, 19);
|
||||
debugLines.push(t + " " + msg);
|
||||
if (debugLines.length > 8) debugLines.shift();
|
||||
document.getElementById("debugText").textContent = debugLines.join("\n");
|
||||
}
|
||||
|
||||
// The plugin process restarts after an update, and a freshly-restarted
|
||||
// process has no way to push to an already-open panel (Stream Deck only
|
||||
// tells a plugin a panel is visible via a live didAppear/onSendToPlugin
|
||||
// round trip, which a cold-started process hasn't received yet). So the
|
||||
// panel re-requests the version itself a few times after the restart
|
||||
// window, instead of waiting on the plugin to notify it.
|
||||
function pollForVersionRefresh() {
|
||||
var token = document.getElementById("notionToken").value.trim();
|
||||
[1500, 3500, 6000, 9000].forEach(function(delay) {
|
||||
setTimeout(function() {
|
||||
debugLog("poll: sending refreshProjects (+" + delay + "ms)");
|
||||
$PI.sendToPlugin({ event: "refreshProjects", token: token });
|
||||
}, delay);
|
||||
});
|
||||
}
|
||||
|
||||
// Collapsible credentials section
|
||||
document.getElementById("credToggle").addEventListener("click", function() {
|
||||
var section = document.getElementById("credSection");
|
||||
@@ -280,7 +254,6 @@
|
||||
}
|
||||
|
||||
$PI.onConnected(function(jsn) {
|
||||
debugLog("$PI.onConnected fired (panel loaded/reloaded)");
|
||||
currentSettings = jsn.actionInfo.payload.settings || {};
|
||||
$PI.getSettings();
|
||||
$PI.getGlobalSettings();
|
||||
@@ -289,10 +262,8 @@
|
||||
document.getElementById("notionToken").addEventListener("input", scheduleCredSave);
|
||||
document.getElementById("userId").addEventListener("change", saveCredentials);
|
||||
document.getElementById("updateBtn").addEventListener("click", function() {
|
||||
debugLog("Check for Updates clicked");
|
||||
document.getElementById("updateStatus").textContent = "";
|
||||
$PI.sendToPlugin({ event: "checkForUpdates" });
|
||||
pollForVersionRefresh();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -332,7 +303,6 @@
|
||||
|
||||
$PI.onSendToPropertyInspector(ACTION_UUID, function(jsn) {
|
||||
var payload = jsn.payload;
|
||||
debugLog("received: " + payload.event + (payload.version ? " v" + payload.version : ""));
|
||||
if (payload.event === "updateStatus") {
|
||||
document.getElementById("updateStatus").textContent = payload.message;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user