fix(userRepo): unwrap reactive proxies before postMessage to worker

Vue reactive Proxies cannot be serialized by the Structured Clone
Algorithm used by postMessage/Comlink. Use toRaw() on this.files and
this.userSettings before passing them to data.update() to avoid the
DataCloneError.
This commit is contained in:
Julien Calixte
2026-04-27 10:22:20 +02:00
parent d50adc72e9
commit df3e217d01

View File

@@ -1,3 +1,4 @@
import { toRaw } from "vue"
import { defineStore } from "pinia"
import { data, generateId } from "@/data/data"
@@ -156,7 +157,7 @@ export const useUserRepoStore = defineStore("USER_REPO_STATE", {
chosenFontSize: _s,
chosenFontFamily: _f,
...repoConfig
} = this.userSettings
} = toRaw(this.userSettings)
data.update<DataType.UserSettings, UserSettings>({
...repoConfig,
_id: userSettingsId
@@ -184,7 +185,7 @@ export const useUserRepoStore = defineStore("USER_REPO_STATE", {
DataType.SavedRepo,
`${this.user}-${this.repo}`
)
const newFiles = [...this.files.filter((f) => f.sha !== file.sha), file]
const newFiles = [...toRaw(this.files).filter((f) => f.sha !== file.sha), toRaw(file)]
data.update<DataType.SavedRepo, SavedRepo>({
_id: savedRepoId,
$type: DataType.SavedRepo,