microsoft / microsoft/TypeScript-Website

Error during textUpdated

Offen
#3,376 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
TypeScript
Sterne
2.6k
Forks
1.5k
Ø Merge
2 T. 2 Std.
Gemergte PRs (30 T.)
7

Beschreibung

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

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne in packages/sandbox/src/index.ts bei textUpdated um Zeile 227 und beim setTimeout in createTypeScriptSandbox um Zeile 246. Reproduziere die Entsorgung, bevor der Timeout abgeschlossen ist, und überprüfe anschließend, dass die Sandbox keine Ausnahme mehr auslöst, wenn editor.getModel() null ist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
typescript
Bereich
frontend
Issue-Typ
Bug
Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Aktivitätsstatus
Veraltet
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
55/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.