fix: undefined instance path by using emitted event instead when opening world folder (#3746)

* fix: undefined instance path by using emitted event instead

* fix: linting
This commit is contained in:
Magnus Jensen
2025-06-12 00:25:20 +02:00
committed by GitHub
parent 4386891716
commit 6955731def
2 changed files with 6 additions and 8 deletions

View File

@@ -1,11 +1,7 @@
<script setup lang="ts">
import dayjs from 'dayjs'
import type { ServerStatus, ServerWorld, World } from '@/helpers/worlds.ts'
import {
set_world_display_status,
getWorldIdentifier,
showWorldInFolder,
} from '@/helpers/worlds.ts'
import type { ServerStatus, ServerWorld, SingleplayerWorld, World } from '@/helpers/worlds.ts'
import { set_world_display_status, getWorldIdentifier } from '@/helpers/worlds.ts'
import { formatNumber, getPingLevel } from '@modrinth/utils'
import {
useRelativeTime,
@@ -49,6 +45,7 @@ const router = useRouter()
const emit = defineEmits<{
(e: 'play' | 'play-instance' | 'update' | 'stop' | 'refresh' | 'edit' | 'delete'): void
(e: 'open-folder', world: SingleplayerWorld): void
}>()
const props = withDefaults(
@@ -380,8 +377,7 @@ const messages = defineMessages({
{
id: 'open-folder',
shown: world.type === 'singleplayer',
action: () =>
world.type === 'singleplayer' ? showWorldInFolder(instancePath, world.path) : {},
action: () => (world.type === 'singleplayer' ? emit('open-folder', world) : {}),
},
{
divider: true,

View File

@@ -86,6 +86,7 @@
world.type === 'server' ? editServerModal?.show(world) : editWorldModal?.show(world)
"
@delete="() => promptToRemoveWorld(world)"
@open-folder="(world: SingleplayerWorld) => showWorldInFolder(instance.path, world.path)"
/>
</div>
</div>
@@ -151,6 +152,7 @@ import {
hasQuickPlaySupport,
refreshWorlds,
handleDefaultProfileUpdateEvent,
showWorldInFolder,
} from '@/helpers/worlds.ts'
import AddServerModal from '@/components/ui/world/modal/AddServerModal.vue'
import EditServerModal from '@/components/ui/world/modal/EditServerModal.vue'