fix: memory issues when importing giant mrpack files (#6278)

* feat: dont load mrpacks into memory if they are local imports

* fix: frontend
This commit is contained in:
Calum H.
2026-06-02 12:59:41 +00:00
committed by GitHub
parent 6b0a0c1897
commit cfe45b368c
11 changed files with 333 additions and 92 deletions
@@ -196,9 +196,11 @@ watch(
)
async function triggerFileInput() {
const picked = await filePicker.pickModpackFile()
const picked = await filePicker.pickModpackFile({
readFile: ctx.flowType !== 'instance',
})
if (picked) {
ctx.modpackFile.value = picked.file
ctx.modpackFile.value = picked.file ?? null
ctx.modpackFilePath.value = picked.path ?? null
proceedWithModpack()
}
@@ -572,7 +572,7 @@ provideInstallationSettings({
if (modpack.value.spec.platform === 'local_file') {
debug('reinstallModpack: local file, opening file picker')
const picked = await filePicker.pickModpackFile()
if (!picked) return
if (!picked?.file) return
try {
const handle = client.kyros.content_v1.uploadModpackFile(
worldId.value!,
+11 -1
View File
@@ -9,11 +9,21 @@ export interface PickedFile {
previewUrl: string
}
export interface PickedModpackFile extends Omit<PickedFile, 'file'> {
/** Only present for upload flows; native imports avoid copying huge packs into the webview heap. */
file?: File
}
export interface PickModpackFileOptions {
/** Set to false when a native path can be streamed directly by the backend. */
readFile?: boolean
}
export interface FilePickerProvider {
/** Pick an image file (for icons) */
pickImage: () => Promise<PickedFile | null>
/** Pick a .mrpack modpack file */
pickModpackFile: () => Promise<PickedFile | null>
pickModpackFile: (options?: PickModpackFileOptions) => Promise<PickedModpackFile | null>
}
export const [injectFilePicker, provideFilePicker] = createContext<FilePickerProvider>('FilePicker')