uiwjs / uiwjs/react-codemirror
Improving `Largest Contentful Paint` time?
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.3k
- Forks
- 161
- PR merge metrics
- No merged PRs in 30d
Description
Hi there, I'm using this library for https://www.timecomplexity.ai, and it's working nicely, so thank you for that!
One issue I'm seeing though is that the Largest Contentful Paint time is quite high because of this library:
Curious if you have any suggestions on how to improve this? I'm using it in a next.js site hosted on Vercel like this:
import CodeMirror from '@uiw/react-codemirror'
import {go} from '@codemirror/legacy-modes/mode/go'
import {xcodeDarkInit} from '@uiw/codemirror-theme-xcode'
export default function Analysis() {
return (
<CodeMirror
value={inputCode}
placeholder={'Use AI to analyze your code\'s runtime complexity.\nWorks across languages and without requiring headers, imports, or a main statement - just the code itself.\nPlease note that results may be incorrect in subtle (or not so subtle) ways, so use at your own risk!'}
autoFocus
editable={!loading}
minHeight="300px"
extensions={[
StreamLanguage.define(go),
EditorView.lineWrapping
]}
theme={xcodeDarkInit({
settings: {
fontFamily: inputCode.length === 0 ? 'var(--font-inter)' : ''
}
})}
onChange={(value: any) => {
if (value.length > MAX_CODE_LENGTH) {
setErrorMessage(`Please enter code less than ${MAX_CODE_LENGTH} characters. You are currently at ${value.length} characters.`)
} else if (typeof errorMessage !== 'string' || typeof errorMessage === 'string' && errorMessage.length !== 0) {
setErrorMessage('')
}
setInputCode(value)
}}
/>
)
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the CodeMirror usage shown in the issue and profile its impact on Largest Contentful Paint in the reported Next.js and Vercel setup. Compare the editor's loading and rendering behavior with the page's LCP measurement; done means identifying a reproducible cause and a clearly validated improvement.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- next.js, react, typescript
- Domain
- frontend, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100