Merge pull request #1 from applex250/fix/default-max-black-no-flash

fix: default to max dark frame on load to avoid white flash
This commit is contained in:
kingOfSoySauce
2026-08-16 14:10:24 +08:00
committed by GitHub
3 changed files with 15 additions and 8 deletions

View File

@@ -764,8 +764,10 @@ var SkinPresenter = class {
portrait; portrait;
preloads; preloads;
enabled = true; enabled = true;
frame = 0; // Default to the max frame so the first paint after load is the dark shell;
pendingFrame = 0; // starting at 0 flashed the light palette before the directory resolved.
frame = PREVIEW_MAX_FRAME;
pendingFrame = PREVIEW_MAX_FRAME;
raf = 0; raf = 0;
disposed = false; disposed = false;
unsubscribe; unsubscribe;
@@ -951,7 +953,7 @@ function LiangEffortSlider({ directory, load, select, presenter, scope }) {
reasoning?.selection.reasoningEffort, reasoning?.selection.reasoningEffort,
reasoning?.defaultEffort reasoning?.defaultEffort
); );
const committedFrame = committedIndex < 0 ? 0 : frameForEffort(committedIndex, efforts.length); const committedFrame = committedIndex < 0 ? PREVIEW_MAX_FRAME : frameForEffort(committedIndex, efforts.length);
const [frame, setFrame] = (0, import_react.useState)(committedFrame); const [frame, setFrame] = (0, import_react.useState)(committedFrame);
const [pending, setPending] = (0, import_react.useState)(false); const [pending, setPending] = (0, import_react.useState)(false);
const [failed, setFailed] = (0, import_react.useState)(false); const [failed, setFailed] = (0, import_react.useState)(false);

File diff suppressed because one or more lines are too long

View File

@@ -142,8 +142,10 @@ class SkinPresenter {
private readonly portrait: HTMLImageElement; private readonly portrait: HTMLImageElement;
private readonly preloads: HTMLImageElement[]; private readonly preloads: HTMLImageElement[];
private enabled = true; private enabled = true;
private frame = 0; // Default to the max frame so the first paint after load is the dark shell;
private pendingFrame = 0; // starting at 0 flashed the light palette before the directory resolved.
private frame = PREVIEW_MAX_FRAME;
private pendingFrame = PREVIEW_MAX_FRAME;
private raf = 0; private raf = 0;
private disposed = false; private disposed = false;
private unsubscribe: () => void; private unsubscribe: () => void;
@@ -355,8 +357,11 @@ function LiangEffortSlider({ directory, load, select, presenter, scope }: Slider
reasoning?.selection.reasoningEffort, reasoning?.selection.reasoningEffort,
reasoning?.defaultEffort, reasoning?.defaultEffort,
); );
// An unknown committed effort defaults to the max frame: a fresh
// conversation paints the dark shell immediately instead of flashing the
// light palette until the directory load resolves the real effort.
const committedFrame = committedIndex < 0 const committedFrame = committedIndex < 0
? 0 ? PREVIEW_MAX_FRAME
: frameForEffort(committedIndex, efforts.length); : frameForEffort(committedIndex, efforts.length);
const [frame, setFrame] = useState(committedFrame); const [frame, setFrame] = useState(committedFrame);
const [pending, setPending] = useState(false); const [pending, setPending] = useState(false);