fix(ui): resolve Monaco marker race conditions and optimize store selectors#791
Open
tirth707 wants to merge 8 commits intoaccordproject:mainfrom
Open
fix(ui): resolve Monaco marker race conditions and optimize store selectors#791tirth707 wants to merge 8 commits intoaccordproject:mainfrom
tirth707 wants to merge 8 commits intoaccordproject:mainfrom
Conversation
Signed-off-by: tirth707 <ptirth2206@gmail.com>
✅ Deploy Preview for ap-template-playground ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a Monaco Editor race condition in the Concerto editor where error markers were being attached to the wrong editor instance (due to global model indexing), and adds shallow equality comparisons to Zustand selectors in App.tsx and ConcertoEditor.tsx to reduce unnecessary re-renders on every keystroke. It also introduces deltaDecorations for a full-line red background highlight on syntax errors and removes unused imports.
Changes:
- Scoped Monaco editor instance via
useRefinConcertoEditor.tsxand applied markers/decorations to the correct model. - Added
shallowcomparisons to Zustand selectors inConcertoEditor.tsxandApp.tsxto prevent top-level re-renders on every store update. - Cleaned up unused variables, removed
useCallbackwrapper foronChange, and removed inline suggestion options fromConcertoEditor.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 9 comments.
| File | Description |
|---|---|
src/editors/ConcertoEditor.tsx |
Core fix: scopes editor with useRef, applies decorations/markers to the correct model; also removes aiConfig selector and inlineSuggest options, uses state: any, and injects a <style> tag inline |
src/App.tsx |
Wraps the isAIConfigOpen/setAIConfigOpen selector with shallow; adds state: any to all store selectors; strips context strings from console.error calls |
…xing types Signed-off-by: tirth707 <ptirth2206@gmail.com>
Signed-off-by: tirth707 <ptirth2206@gmail.com>
Signed-off-by: tirth707 <ptirth2206@gmail.com>
Signed-off-by: tirth707 <ptirth2206@gmail.com>
Signed-off-by: tirth707 <ptirth2206@gmail.com>
Signed-off-by: tirth707 <ptirth2206@gmail.com>
…dering Signed-off-by: tirth707 <ptirth2206@gmail.com>
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.
Closes #782
This PR addresses an architectural issue where Monaco error markers were failing to render correctly in the Concerto editor, alongside a state-management bottleneck that caused unnecessary application-wide re-renders.
By scoping the editor instances and refining how we pull data from the Zustand store, the editor now accurately highlights syntax errors visually, and typing performance is significantly smoother.
Changes
useRefto ensure error markers are reliably applied to the correct active model.deltaDecorationsto provide a clear, full-line red background highlight for syntax errors, mapping exactly to the compiler's line output.App.tsxandConcertoEditor.tsxwithshallowcomparisons to prevent the top-level layout from re-rendering on every keystroke.Flags
zustand/shallowimport path rather than the newerzustand/react/shallowto maintain compatibility with the project's current version of Zustand.Screenshots or Video
Before:


After: *
Related Issues
Author Checklist
--signoffoption of git commit.mainfromfork:branchname