microsoft / microsoft/TypeScript-Website
Error during textUpdated
Nessuno ha ancora preso questa issue.
- Lingua principale
- TypeScript
- Stelle
- 2.6k
- Fork
- 1.5k
- Merge medio
- 2g 2h
- PR unite (30g)
- 7
Descrizione
short question before oepning a PR:
the following bug is part of the sanbox code , but not necessarily from the playground website ,im also using it in my own site
ive checked the code, and it looks similar enough so i assume it could be considered a bug
(update: ive played around a bit on the website and it seems that due to the amount of entire page reloads ur doing this is not an issue here 🤔)
Page URL: local page
Issue:
in https://github.com/microsoft/TypeScript-Website/blob/v2/packages/sandbox/src/index.ts#L227
const code = editor.getModel()!.getValue()
im getting
TypeError: can't access property "getValue", editor.getModel() is null
textUpdated index.ts:227
createTypeScriptSandbox index.ts:246
coming from the setTimeout in
https://github.com/microsoft/TypeScript-Website/blob/v2/packages/sandbox/src/index.ts#L246
i think this is mainly caused when the editor is disposed before the setTimeout finishes
my PR would just be to return the function if the model isnt there currently , this way there at least isnt an error
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
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.
Direzione di ricerca
Inizia in packages/sandbox/src/index.ts, su textUpdated intorno alla riga 227 e sul setTimeout in createTypeScriptSandbox intorno alla riga 246. Riproduci la disposizione prima che il timeout termini, quindi verifica che la sandbox non generi più un'eccezione quando editor.getModel() è null.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- typescript
- Ambito
- frontend
- Tipo di issue
- Bug
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Stato di attività
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 55/100