From bee249b7ea033d8ce6a03613d48eb46440953734 Mon Sep 17 00:00:00 2001 From: zurdi Date: Fri, 18 Sep 2026 12:31:46 +0200 Subject: [PATCH] refactor(player): simplify save/state loading (simplify) - The shell passes the Load button's label as a prop, so the shared Player no longer reads the UI version to guess which picker answers. - The file-picker fallback after a save or state download is gone: an arraybuffer response is always an ArrayBuffer, so it never ran. - The picker keeps its saves and states lists in one place for the tabs and the lists. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_015CErWeM5xFMumPtHozLcCV --- .../components/Player/LoadSaveStateDialog.vue | 12 ++--- frontend/src/v2/views/Player/EmulatorJS.vue | 1 + .../src/views/Player/EmulatorJS/Player.vue | 45 ++++++------------- 3 files changed, 22 insertions(+), 36 deletions(-) diff --git a/frontend/src/v2/components/Player/LoadSaveStateDialog.vue b/frontend/src/v2/components/Player/LoadSaveStateDialog.vue index a163b3262..8d65fb7a1 100644 --- a/frontend/src/v2/components/Player/LoadSaveStateDialog.vue +++ b/frontend/src/v2/components/Player/LoadSaveStateDialog.vue @@ -3,7 +3,7 @@ // on `selectStateDialog`, emits `saveSelected` or `stateSelected`. import { RBtn, RDialog, RSliderBtnGroup } from "@v2/lib"; import type { Emitter } from "mitt"; -import { inject, onBeforeUnmount, ref } from "vue"; +import { computed, inject, onBeforeUnmount, ref } from "vue"; import { useI18n } from "vue-i18n"; import type { SaveSchema, StateSchema } from "@/__generated__"; import type { DetailedRom } from "@/stores/roms"; @@ -25,9 +25,11 @@ const rom = ref(null); // States apply on the fly, so they are what the button reaches for first. const tab = ref("state"); +const saves = computed(() => rom.value?.user_saves ?? []); +const states = computed(() => rom.value?.user_states ?? []); const { tabs, stateDisabledReason } = useSaveStateTabs( - () => rom.value?.user_saves ?? [], - () => rom.value?.user_states ?? [], + saves, + states, () => window.EJS_core, ); @@ -96,14 +98,14 @@ function closeDialog() {