prevent filcker when swtiching config

This commit is contained in:
pa
2026-01-02 16:50:59 +09:00
committed by Natsumi
parent 367a517337
commit ceb36d0c90

View File

@@ -105,7 +105,7 @@
</template>
<script setup>
import { computed, nextTick, ref, watch } from 'vue';
import { computed, nextTick, onBeforeUnmount, ref, watch } from 'vue';
import { CopyDocument, Warning } from '@element-plus/icons-vue';
import { ElMessage, ElMessageBox } from 'element-plus';
import { storeToRefs } from 'pinia';
@@ -135,6 +135,12 @@
const launchDialogIndex = ref(2000);
let launchAsDesktopTimeoutId;
onBeforeUnmount(() => {
clearTimeout(launchAsDesktopTimeoutId);
});
const launchDialog = ref({
loading: false,
desktop: false,
@@ -231,9 +237,12 @@
function handleLaunchCommand(command, location, shortName) {
const desktop = command === 'desktop';
launchDialog.value.desktop = desktop;
configRepository.setBool('launchAsDesktop', desktop);
handleLaunchGame(location, shortName, desktop);
clearTimeout(launchAsDesktopTimeoutId);
launchAsDesktopTimeoutId = setTimeout(() => {
launchDialog.value.desktop = desktop;
}, 500);
}
function handleAttachGame(location, shortName) {
tryOpenInstanceInVrc(location, shortName);