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">
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 { t } from '../i18n';
@@ -60,18 +60,17 @@ const commentaryGraphic = computed(() =>
const selectedScoreboardSkin = ref<string>('');
watchEffect(() => {
const availableSkins = scoreboardGraphics.value;
watch(
[scoreboardGraphics, () => graphicsSettingsReplicant?.data?.scoreboardSkin],
([availableSkins, replicatedSkin]) => {
if (availableSkins.length === 0) {
selectedScoreboardSkin.value = '';
return;
}
const replicatedSkin = graphicsSettingsReplicant?.data?.scoreboardSkin ?? '';
const hasReplicatedSkin = availableSkins.some((graphic) => graphic.file === replicatedSkin);
if (hasReplicatedSkin && selectedScoreboardSkin.value !== replicatedSkin) {
selectedScoreboardSkin.value = replicatedSkin;
if (hasReplicatedSkin) {
selectedScoreboardSkin.value = replicatedSkin ?? "";
return;
}
@@ -82,7 +81,9 @@ watchEffect(() => {
if (!hasCurrentSkin) {
selectedScoreboardSkin.value = availableSkins[0]!.file;
}
});
},
{ immediate: true },
);
watch(
selectedScoreboardSkin,