Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Every playground store update rewrites about 1.4 MB of built-in examples to IndexedDB

Aperta
#1,756 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

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

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

Area: Playground Difficulty: Low Enhancement Performance Priority: Medium

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

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di DouglasNeuroInformatics/OpenDataCapture

Tutte le issue di DouglasNeuroInformatics/OpenDataCapture

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.