mirror of
https://github.com/screentinker/screentinker.git
synced 2026-08-13 22:03:13 -06:00
fix(dashboard): device-detail.js parse + runtime errors that killed the whole view
The #150 re-adopt commit (74e7062) left device-detail.js unparseable and, once parsed,
unexecutable — so the entire device-detail view's JS was dead (settings, #150 re-adopt UI, delete):
- SyntaxError at 768: `await api.getContent()` at the top level of the non-async setupActions()
("Unexpected reserved word") -> the whole module fails to parse. Fixed with the .then() pattern
already used by the sibling playlist picker, keeping setupActions synchronous so every listener
below it (save, #150 re-adopt, delete) still registers immediately (making it async would defer
them behind the fetch).
- Stray `async` orphaned on its own line (was line 648) before showReAdoptModal's doc comment:
parses, but executes as the bare identifier statement `async;` -> ReferenceError at module load,
which would keep the view dead even after the parse fix. Removed it.
Also add <meta name="mobile-web-app-capable"> beside the apple- one (clears the deprecation warning).
Full frontend ES-module parse-scan clean; both bugs were confined to this file.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
4cf156d4a0
commit
c5ddb82cba
|
|
@ -5,6 +5,7 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="theme-color" content="#111827">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
||||
<link rel="manifest" href="/manifest.json">
|
||||
<link rel="icon" href="/assets/icon-192.png">
|
||||
|
|
|
|||
|
|
@ -645,7 +645,7 @@ function showDevicePreview(device) {
|
|||
});
|
||||
}
|
||||
|
||||
async // #150 re-adopt fallback: browse the workspace's previously-removed device snapshots and
|
||||
// #150 re-adopt fallback: browse the workspace's previously-removed device snapshots and
|
||||
// apply one onto THIS (usually blank, just-re-paired) device. Primary restore is the silent
|
||||
// fingerprint-match on re-pair; this is for factory-reset / new-hardware / changed-fingerprint.
|
||||
const ORIENT_LABELS = {
|
||||
|
|
@ -763,9 +763,11 @@ function setupActions(device) {
|
|||
}
|
||||
});
|
||||
|
||||
// Populate default content dropdown
|
||||
try {
|
||||
const content = await api.getContent();
|
||||
// Populate default content dropdown (async, non-blocking — same .then() pattern as the
|
||||
// playlist picker below). setupActions is a SYNCHRONOUS function; awaiting here made the whole
|
||||
// file fail to parse ("Unexpected reserved word") AND would have deferred every listener below
|
||||
// (save, #150 re-adopt, delete) until this fetch resolved. .then() keeps them registering immediately.
|
||||
api.getContent().then(content => {
|
||||
const defaultSelect = document.getElementById('deviceDefaultContent');
|
||||
if (defaultSelect) {
|
||||
content.forEach(c => {
|
||||
|
|
@ -775,7 +777,7 @@ function setupActions(device) {
|
|||
defaultSelect.appendChild(opt);
|
||||
});
|
||||
}
|
||||
} catch {}
|
||||
}).catch(() => {});
|
||||
|
||||
// Save settings (notes + orientation + default content)
|
||||
// Debug logging toggle: sends a transient set_debug command to the device and
|
||||
|
|
|
|||
Loading…
Reference in a new issue