Repository navigation
Improve editor performance and responsiveness - #234
Merged
Merged
Conversation
Deploying showcode with
|
| Latest commit: |
6bd1432
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://c4004495.showcode.pages.dev |
| Branch Preview URL: | https://performance-improvements.showcode.pages.dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This moves syntax highlighting into a worker, loads Monaco and image export code on demand, and only renders the theme cards near the visible area. Resizing and preview updates are batched to keep typing and dragging responsive.
I've preserved Monaco's editor features and language support, made asynchronous theme and language changes ignore stale results, and ensured pending appearance changes are saved when switching tabs. Highlighting and preview capture now each have a shared composable that owns their scheduling and cleanup. Export and Copy wait for the latest highlighted code, while Safari retains the clipboard timing it requires.
Thumbnail generation no longer repeats because its own image changed, and the app shell and highlighting worker remain available offline. Monaco's language loaders are indexed once and reused. The editor component is client-only so its browser runtime and language modules stay out of Cloudflare's server bundle.
Validated with 155 passing tests, Cloudflare Pages and desktop production builds, and an Electron smoke check covering highlighting, theme previews, and PNG export over the app:// protocol with external network requests blocked. Earlier browser checks also covered editor resizing, JSON formatting, tab switching, and offline reopening.