Skip to content

Commit 158dc88

Browse files
committed
Address Claude review feedback (round 3)
- handleSaveConfig now clears the result banner only after the file is actually written, matching handleLoadConfig, so cancelling the save dialog no longer wipes a prior "Saved setup…" message. - handleLoadConfig short-circuits only on a cancelled picker (null result); an empty file now flows through to parseTourConfig so it surfaces a real error instead of silently doing nothing.
1 parent 756276d commit 158dc88

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

apps/geolibre-desktop/src/components/layout/RecordTourDialog.tsx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,6 @@ export function RecordTourDialog({
377377
// it can be reloaded and refined later, independent of the recorded video.
378378
const handleSaveConfig = async () => {
379379
if (keyframes.length === 0) return;
380-
clearResultMessages();
381380
try {
382381
const content = serializeTourConfig(keyframes, fps);
383382
const fileType = t("recordTour.configFileType");
@@ -389,9 +388,15 @@ export function RecordTourDialog({
389388
],
390389
mimeType: "application/json",
391390
});
392-
if (name) setConfigMessage(t("recordTour.configSaved", { name }));
391+
// Cancelling the dialog returns null and is a no-op, so only clear a prior
392+
// result banner once the file is actually written.
393+
if (name) {
394+
clearResultMessages();
395+
setConfigMessage(t("recordTour.configSaved", { name }));
396+
}
393397
} catch (err) {
394398
console.warn("Tour configuration save failed", err);
399+
clearResultMessages();
395400
setError(t("recordTour.configSaveError"));
396401
}
397402
};
@@ -412,11 +417,12 @@ export function RecordTourDialog({
412417
accept: ".json,application/json",
413418
readText: true,
414419
});
415-
// Cancelling the picker is a no-op, so only clear a prior result banner
416-
// once a file is actually chosen.
417-
if (!result?.text) return;
420+
// Only a null result means the picker was cancelled (a no-op). An empty
421+
// file still flows through so parseTourConfig surfaces a real error rather
422+
// than silently doing nothing after the user explicitly chose a file.
423+
if (result == null) return;
418424
clearResultMessages();
419-
const config = parseTourConfig(result.text);
425+
const config = parseTourConfig(result.text ?? "");
420426
setKeyframes(config.keyframes.map((kf) => ({ ...kf, id: createId() })));
421427
setFps(config.fps);
422428
setFpsText(String(config.fps));

0 commit comments

Comments
 (0)