-
Notifications
You must be signed in to change notification settings - Fork 296
Show editor immediately while WASM compiler loads #16751
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -135,6 +135,7 @@ let isReady = false; | |||
| let isCompiling = false; | ||||
| let compileTimer = null; | ||||
| let currentYaml = ''; | ||||
| let pendingCompile = false; | ||||
|
|
||||
| // --------------------------------------------------------------- | ||||
| // Theme (uses Primer's data-color-mode) | ||||
|
|
@@ -187,8 +188,12 @@ const editorView = new EditorView({ | |||
| run: () => { doCompile(); return true; } | ||||
| }]), | ||||
| EditorView.updateListener.of(update => { | ||||
| if (update.docChanged && isReady) { | ||||
| scheduleCompile(); | ||||
| if (update.docChanged) { | ||||
| if (isReady) { | ||||
| scheduleCompile(); | ||||
| } else { | ||||
| pendingCompile = true; | ||||
| } | ||||
| } | ||||
| }), | ||||
| ], | ||||
|
|
@@ -488,6 +493,18 @@ document.addEventListener('touchend', () => { | |||
| // Initialize compiler | ||||
| // --------------------------------------------------------------- | ||||
| async function init() { | ||||
| // Hide the loading overlay immediately — the editor is already visible | ||||
| loadingOverlay.classList.add('hidden'); | ||||
|
||||
| loadingOverlay.classList.add('hidden'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
pendingCompileflag is declared but never actually used. It's set totrueon line 195 when the document changes before the compiler is ready, but it's never checked anywhere in the code. SincedoCompile()is called unconditionally on line 518 after the compiler is ready, it will compile whatever content is in the editor at that time (whether it was edited or not), making this flag unnecessary. Consider removing this unused variable to reduce code complexity.