perf: move PouchDB/IndexedDB operations to a Web Worker
All database reads and writes now run off the main thread via a dedicated worker, eliminating IndexedDB overhead from the frame budget. - Create data.worker.ts exposing the Data class via Comlink - Refactor data.ts to export a Comlink-wrapped proxy and a standalone generateId() pure function (workers can't expose sync methods cleanly) - Update all 10 call sites to import generateId directly instead of calling data.generateId() Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { computed, onMounted, ref } from "vue"
|
||||
|
||||
import { data } from "@/data/data"
|
||||
import { data, generateId } from "@/data/data"
|
||||
import { DataType } from "@/data/DataType.enum"
|
||||
import { useRepos } from "@/hooks/useRepos.hook"
|
||||
import { RepoBase } from "@/modules/repo/interfaces/RepoBase"
|
||||
@@ -27,7 +27,7 @@ export const useFavoriteRepos = () => {
|
||||
|
||||
const toggleFavorite = async (repo: RepoBase, isFavorite: boolean) => {
|
||||
const favorite: FavoriteRepo = {
|
||||
_id: data.generateId(DataType.FavoriteRepo, repo.id),
|
||||
_id: generateId(DataType.FavoriteRepo, repo.id),
|
||||
$type: DataType.FavoriteRepo,
|
||||
isFavorite,
|
||||
name: repo.name,
|
||||
|
||||
Reference in New Issue
Block a user