Every playground store update rewrites about 1.4 MB of built-in examples to IndexedDB
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 58/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- nodejs, react, typescript
- Ambito
- database, performance
Direzione di ricerca
Start with apps/playground/src/store/index.ts and its persistence tests in apps/playground/src/store/__tests__/index.test.ts; inspect how partialize, merge, and migration handle stored instruments. Then read apps/playground/src/hooks/useEditorErrorSync.ts and check how marker and file updates trigger error writes. Verify the test confirms only saved instruments and the selected ID are persisted, and that the legacy stored shape is handled.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Every playground store update rewrites about 1.4 MB of built-in example instruments to IndexedDB, and a single keystroke causes several such writes. partialize persists the whole instruments list and the whole selectedInstrument. But merge keeps only Saved instruments and the selected instrument's id when it loads, so everything else written is thrown away on the next load. The examples carry base64 media (cat-video.mp4, cow-moo.mp3, smiley.png, …). Serialized the way partialize writes them, the current src/instruments catalog alone is 1,434,683 bytes, plus the selected instrument's files a second time. Zustand's persist writes on every set. One keystroke triggers updateFile, then setEditorErrors from useEditorErrorSync's files subscription (always a new array, even when nothing changed), then setEditorErrors again when Monaco's markers update. Each rebuild adds building and built. Typing for a minute serializes and writes hundreds of megabytes to IndexedDB, nearly all of it discarded data.
Where
apps/playground/src/store/index.ts:77-83:
partialize: (state) => {
return {
...pick(state, ['instruments', 'selectedInstrument', 'settings']),
_accessToken: state.auth?.accessToken
};
},
apps/playground/src/hooks/useEditorErrorSync.ts:31-37:
const refresh = () => {
const filenames = useAppStore.getState().files.map((file) => file.name);
setEditorErrors(collectEditorErrors(monaco, filenames));
};
refresh();
const markersListener = monaco.editor.onDidChangeMarkers(refresh);
const unsubscribeFromFiles = useAppStore.subscribe((store) => store.files, refresh);
Reproduce
Mechanism and scale: open DevTools > Application > IndexedDB > keyval-store > keyval, type in the editor, and watch the app entry. It is rewritten with the full ~1.4 MB catalog several times per keystroke. The size grows with every example or template that gains an asset, and with each saved instrument.
Tests
apps/playground/src/store/__tests__/index.test.ts (mock idb-keyval): it('should persist only saved instruments and the selected instrument's id, so built-in examples are never written to IndexedDB'). No end-to-end test: the change affects only what is stored, and the existing playground specs cover reload behaviour.
Suggested fix
Persist instruments.filter((instrument) => instrument.category === 'Saved') and selectedInstrument.id rather than the full object, and bump version with a migrate for the old shape. In useEditorErrorSync, skip setEditorErrors when the collected errors equal the current ones.
- Lingua principale
- TypeScript
- Stelle
- 119
- Fork
- 19
- Merge medio
- 4g 11h
- PR unite (30g)
- 35
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di DouglasNeuroInformatics/OpenDataCapture
-
Area: Infrastructure Chore Difficulty: Low Good First Issue Priority: Low
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
DouglasNeuroInformatics/OpenDataCapture#1836 ·
I maintainer di solito rispondono entro 1 giorno
-
Area: Infrastructure Chore Difficulty: Low Priority: Medium
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
DouglasNeuroInformatics/OpenDataCapture#1835 ·
I maintainer di solito rispondono entro 1 giorno
-
Area: Playground Bug Difficulty: Low Good First Issue Priority: Medium
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
DouglasNeuroInformatics/OpenDataCapture#1833 ·
I maintainer di solito rispondono entro 1 giorno
-
Area: Instruments Bug Difficulty: Low Priority: Low
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
DouglasNeuroInformatics/OpenDataCapture#1824 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Area: Shared Bug Difficulty: Low Priority: Low
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
DouglasNeuroInformatics/OpenDataCapture#1813 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di DouglasNeuroInformatics/OpenDataCapture
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
marmelab/react-admin#11431 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
db-ux-design-system/core-web#8655 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
stripe/react-stripe-js#728 ·
-
[Upload Grade C dataset] the pop-up changes it's size while uploading the document => Jumping effectApertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
epam/statgpt-admin-frontend#305 ·
I maintainer di solito rispondono entro 1 giorno