Skip to content

Commit 6955731

Browse files
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
1 parent 4386891 commit 6955731

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

apps/app-frontend/src/components/ui/world/WorldItem.vue

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
<script setup lang="ts">
22
import dayjs from 'dayjs'
3-
import type { ServerStatus, ServerWorld, World } from '@/helpers/worlds.ts'
4-
import {
5-
set_world_display_status,
6-
getWorldIdentifier,
7-
showWorldInFolder,
8-
} from '@/helpers/worlds.ts'
3+
import type { ServerStatus, ServerWorld, SingleplayerWorld, World } from '@/helpers/worlds.ts'
4+
import { set_world_display_status, getWorldIdentifier } from '@/helpers/worlds.ts'
95
import { formatNumber, getPingLevel } from '@modrinth/utils'
106
import {
117
useRelativeTime,
@@ -49,6 +45,7 @@ const router = useRouter()
4945
5046
const emit = defineEmits<{
5147
(e: 'play' | 'play-instance' | 'update' | 'stop' | 'refresh' | 'edit' | 'delete'): void
48+
(e: 'open-folder', world: SingleplayerWorld): void
5249
}>()
5350
5451
const props = withDefaults(
@@ -380,8 +377,7 @@ const messages = defineMessages({
380377
{
381378
id: 'open-folder',
382379
shown: world.type === 'singleplayer',
383-
action: () =>
384-
world.type === 'singleplayer' ? showWorldInFolder(instancePath, world.path) : {},
380+
action: () => (world.type === 'singleplayer' ? emit('open-folder', world) : {}),
385381
},
386382
{
387383
divider: true,

apps/app-frontend/src/pages/instance/Worlds.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
world.type === 'server' ? editServerModal?.show(world) : editWorldModal?.show(world)
8787
"
8888
@delete="() => promptToRemoveWorld(world)"
89+
@open-folder="(world: SingleplayerWorld) => showWorldInFolder(instance.path, world.path)"
8990
/>
9091
</div>
9192
</div>
@@ -151,6 +152,7 @@ import {
151152
hasQuickPlaySupport,
152153
refreshWorlds,
153154
handleDefaultProfileUpdateEvent,
155+
showWorldInFolder,
154156
} from '@/helpers/worlds.ts'
155157
import AddServerModal from '@/components/ui/world/modal/AddServerModal.vue'
156158
import EditServerModal from '@/components/ui/world/modal/EditServerModal.vue'

0 commit comments

Comments
 (0)