Unione di funzione/sessione-s4b in funzione/codec-immagini: porta la correzione di connection.js
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
432b8f0a85
3 files changed
+725
-5
No files matched your search
@@ -328,7 +328,7 @@ export function savedSessionBox(saved, page) {
|
||||
// Neither choice is shown as chosen, and neither can be picked, until the server says which one is stored: the page
|
||||
// never claims a choice the next copy will not follow. Once Alberto picks one, a late answer no longer changes it;
|
||||
// a choice the server did not save goes back to the one before.
|
||||
let saved = null;
|
||||
let stored = null;
|
||||
let chosen = false;
|
||||
const show = (value) => {
|
||||
keep.input.checked = value === 'tieni-completa';
|
||||
@@ -336,10 +336,10 @@ export function savedSessionBox(saved, page) {
|
||||
};
|
||||
const choose = async (value) => {
|
||||
chosen = true;
|
||||
const before = saved;
|
||||
const before = stored;
|
||||
try {
|
||||
const settings = await api('/api/connection/settings', { method: 'PUT', body: { incompleteCopy: value } });
|
||||
saved = settings && settings.incompleteCopy ? settings.incompleteCopy : value;
|
||||
stored = settings && settings.incompleteCopy ? settings.incompleteCopy : value;
|
||||
unknown.hidden = true;
|
||||
toast(k('salvato'));
|
||||
} catch (error) {
|
||||
@@ -353,8 +353,8 @@ export function savedSessionBox(saved, page) {
|
||||
for (const choice of [replace, keep]) choice.input.disabled = true;
|
||||
api('/api/connection/settings', { signal: page && page.signal }).then((settings) => {
|
||||
if (chosen) return;
|
||||
saved = settings.incompleteCopy;
|
||||
show(saved);
|
||||
stored = settings.incompleteCopy;
|
||||
show(stored);
|
||||
}).catch(() => {
|
||||
if (page && page.signal && page.signal.aborted) return; // the page was left
|
||||
if (!chosen) unknown.hidden = false;
|
||||
|
||||
Reference in new issue
Block a user