Corrige persistencia del selector de skin en GraphicsView

This commit is contained in:
Pandipipas
2026-02-20 22:29:15 +01:00
parent 31c1886a48
commit 62fda3492f
+9 -8
View File
@@ -1,6 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { useHead } from '@unhead/vue'; import { useHead } from '@unhead/vue';
import { computed, ref, watch, watchEffect } from 'vue'; import { computed, ref, watch } from 'vue';
import { graphicsSettingsReplicant } from '../../../browser_shared/replicants'; import { graphicsSettingsReplicant } from '../../../browser_shared/replicants';
import { t } from '../i18n'; import { t } from '../i18n';
@@ -60,18 +60,17 @@ const commentaryGraphic = computed(() =>
const selectedScoreboardSkin = ref<string>(''); const selectedScoreboardSkin = ref<string>('');
watchEffect(() => { watch(
const availableSkins = scoreboardGraphics.value; [scoreboardGraphics, () => graphicsSettingsReplicant?.data?.scoreboardSkin],
([availableSkins, replicatedSkin]) => {
if (availableSkins.length === 0) { if (availableSkins.length === 0) {
selectedScoreboardSkin.value = ''; selectedScoreboardSkin.value = '';
return; return;
} }
const replicatedSkin = graphicsSettingsReplicant?.data?.scoreboardSkin ?? '';
const hasReplicatedSkin = availableSkins.some((graphic) => graphic.file === replicatedSkin); const hasReplicatedSkin = availableSkins.some((graphic) => graphic.file === replicatedSkin);
if (hasReplicatedSkin && selectedScoreboardSkin.value !== replicatedSkin) { if (hasReplicatedSkin) {
selectedScoreboardSkin.value = replicatedSkin; selectedScoreboardSkin.value = replicatedSkin ?? "";
return; return;
} }
@@ -82,7 +81,9 @@ watchEffect(() => {
if (!hasCurrentSkin) { if (!hasCurrentSkin) {
selectedScoreboardSkin.value = availableSkins[0]!.file; selectedScoreboardSkin.value = availableSkins[0]!.file;
} }
}); },
{ immediate: true },
);
watch( watch(
selectedScoreboardSkin, selectedScoreboardSkin,