Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

perf(playground): code improvements #2863

Merged
merged 9 commits into from
Jul 14, 2022
Merged

perf(playground): code improvements #2863

merged 9 commits into from
Jul 14, 2022

Conversation

vramana
Copy link
Contributor

@vramana vramana commented Jul 12, 2022

Summary

Fixes #2856

  • Updated Vite to version 2.9 to add worker support.
  • Updated vite-plugin-svgr to be compatible with Vite 2.9
  • Use react-codemirror instead of react-textarea-code-editor
  • Move formatting from rome and prettier into seperate workers

Test Plan

export enum IndentStyle { Tab = "tab", Space = "space" }
export enum SourceType { Module = "module", Script = "script" }
export enum QuoteStyle { Double = "double", Single = "single" }
export enum IndentStyle {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are too many unnecessary code changes. I will fix them a little later.

@vramana
Copy link
Contributor Author

vramana commented Jul 12, 2022

Before:

Screencast.from.07-12-2022.12.30.39.PM.webm.mov

After:

Screencast.from.07-12-2022.12.29.30.PM.webm.mov

In the after video, you can see characters appearing as I type. The recording is stil choppy on my computer. You can test it either locally or on deployment to feel the difference.

"format:rome": "rome format --write src ."
},
"dependencies": {
"@codemirror/lang-javascript": "^6.0.1",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I notice that you use lang-javascript, does this package support jsx, tsx syntax ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

@ematipico ematipico changed the title Improve playground performance perf(playground): code improvements Jul 12, 2022
@vramana vramana marked this pull request as ready for review July 14, 2022 07:08
@vramana vramana requested a review from a team July 14, 2022 07:08
@ematipico
Copy link
Contributor

ematipico commented Jul 14, 2022

I tried to run the app locally, and it seems there's errors in Firefox:

Screenshot 2022-07-14 at 08 55 58

The error is weird though, because the source code has the import at the top level of the code. So probably there's some transformation that breaks in firefox, or maybe it's a bug in firefox

@vramana
Copy link
Contributor Author

vramana commented Jul 14, 2022

image

Apparently firefox is the hold out here.

It doesn't work in dev (Vite restriction) but works in production. vitejs/vite#4586 (comment)

@vramana
Copy link
Contributor Author

vramana commented Jul 14, 2022

@ematipico Can you approve workflow so the CI can run?

@ematipico
Copy link
Contributor

CI is failing, there's some code not formatted. Just run the command format:rome and you should be fine. The last diagnostic is a false positive that we fixed in main, so you can ignore it

@vramana
Copy link
Contributor Author

vramana commented Jul 14, 2022

@ematipico Done

@ematipico ematipico merged commit 621a3a1 into rome:main Jul 14, 2022
@vramana vramana deleted the playground branch July 14, 2022 14:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

📎 (rome_playground) Improve playground performance
3 participants