Skip to content

fix(ui): resolve Monaco marker race conditions and optimize store selectors#791

Open
tirth707 wants to merge 8 commits intoaccordproject:mainfrom
tirth707:fix-monaco-zustand-render
Open

fix(ui): resolve Monaco marker race conditions and optimize store selectors#791
tirth707 wants to merge 8 commits intoaccordproject:mainfrom
tirth707:fix-monaco-zustand-render

Conversation

@tirth707
Copy link

@tirth707 tirth707 commented Mar 8, 2026

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

  • Scoped Monaco editor instances using useRef to ensure error markers are reliably applied to the correct active model.
  • Implemented Monaco deltaDecorations to provide a clear, full-line red background highlight for syntax errors, mapping exactly to the compiler's line output.
  • Wrapped object-returning Zustand selectors in App.tsx and ConcertoEditor.tsx with shallow comparisons to prevent the top-level layout from re-rendering on every keystroke.
  • Cleaned up unused variables and imports to clear terminal warnings and keep the codebase tidy.

Flags

  • I used the zustand/shallow import path rather than the newer zustand/react/shallow to maintain compatibility with the project's current version of Zustand.

Screenshots or Video

Before:
Screenshot 2026-03-08 at 10 21 24 AM
After: *
Screenshot 2026-03-08 at 10 25 56 AM

Related Issues

Author Checklist

  • Ensure you provide a DCO sign-off for your commits using the --signoff option of git commit.
  • Vital features and changes captured in unit and/or integration tests
  • Commits messages follow AP format
  • Extend the documentation, if necessary
  • Merging to main from fork:branchname

Signed-off-by: tirth707 <ptirth2206@gmail.com>
Copilot AI review requested due to automatic review settings March 8, 2026 05:12
@tirth707 tirth707 requested a review from a team as a code owner March 8, 2026 05:12
@netlify
Copy link

netlify bot commented Mar 8, 2026

Deploy Preview for ap-template-playground ready!

Name Link
🔨 Latest commit b329e61
🔍 Latest deploy log https://app.netlify.com/projects/ap-template-playground/deploys/69ad217633d643000843c676
😎 Deploy Preview https://deploy-preview-791--ap-template-playground.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 useRef in ConcertoEditor.tsx and applied markers/decorations to the correct model.
  • Added shallow comparisons to Zustand selectors in ConcertoEditor.tsx and App.tsx to prevent top-level re-renders on every store update.
  • Cleaned up unused variables, removed useCallback wrapper for onChange, and removed inline suggestion options from ConcertoEditor.

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>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

Signed-off-by: tirth707 <ptirth2206@gmail.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

Signed-off-by: tirth707 <ptirth2206@gmail.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

Signed-off-by: tirth707 <ptirth2206@gmail.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

Signed-off-by: tirth707 <ptirth2206@gmail.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Signed-off-by: tirth707 <ptirth2206@gmail.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

…dering

Signed-off-by: tirth707 <ptirth2206@gmail.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 4 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Syntax error markers attach to wrong editor instances due to global model indexing

2 participants