Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Editor) Cursor Inconsistency and edit lost fix in monaco editor #95

Conversation

nitro56565
Copy link
Contributor

Closes #91

Description

The Monaco editor were experiencing cursor jumping issues and edit lost when updating state using Zustand. The cursor would jump to the top or bottom of the editor, causing a poor user experience. This issue was identified as a result of state updates causing unnecessary re-renders.

Solution

  • To resolve this, I implemented immediate state management for the editor components, separating the state used for rendering the editor (editorValue, editorModelCto, and editorAgreementData) from the state used for processing updates . By updating the rendering state immediately and debouncing the processing state updates, I was able to stop the unnecessary re-rendering that made the cursor jump around all over the place.

Changes Made (TemplateMarkdown, TemplateModel and AgreementData)

  • Replaced direct state updates with immediate state updates in all the three editor components.
  • Implemented debounced updates for all three editors to avoid performance issues.

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

@nitro56565 nitro56565 requested a review from a team as a code owner August 2, 2024 19:10
Copy link

netlify bot commented Aug 2, 2024

Deploy Preview for ap-template-playground ready!

Name Link
🔨 Latest commit 915101b
🔍 Latest deploy log https://app.netlify.com/sites/ap-template-playground/deploys/66ad2f3d56f2d900086b4008
😎 Deploy Preview https://deploy-preview-95--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 site configuration.

@nitro56565
Copy link
Contributor Author

@dselman can you please review the code

@nitro56565 nitro56565 changed the title cursor inconsistency in editor fixed Fix(Editor)cursor inconsistency in editor fixed Aug 3, 2024
@nitro56565 nitro56565 changed the title Fix(Editor)cursor inconsistency in editor fixed fix(Editor) Cursor Inconsistency and edit lost fix in monaco editor Aug 3, 2024
Copy link
Sponsor Contributor

@dselman dselman left a comment

Choose a reason for hiding this comment

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

Nice work!

@dselman dselman merged commit 56b134e into accordproject:main Aug 5, 2024
7 checks passed
@nitro56565 nitro56565 deleted the nitro56565/i95/inconsistent-cursor-movement branch August 5, 2024 15:37
Vinyl-Davyl pushed a commit to Vinyl-Davyl/template-playground that referenced this pull request Aug 29, 2024
Vinyl-Davyl pushed a commit to Vinyl-Davyl/template-playground that referenced this pull request Aug 30, 2024
sanketshevkar pushed a commit that referenced this pull request Sep 3, 2024
* cursor inconsistency in editor fixed (#95)

Signed-off-by: Mahesh Patil <[email protected]>
Signed-off-by: Vinyl-Davyl <[email protected]>

* update(ui): secondary theme color (#93)

* update: development

Signed-off-by: Vinyl-Davyl <[email protected]>

* update: development

Signed-off-by: Vinyl-Davyl <[email protected]>

---------

Signed-off-by: Vinyl-Davyl <[email protected]>
Signed-off-by: Vinyl-Davyl <[email protected]>

* chore(doc): doc updated with recent project feature (#92)

* update: development

Signed-off-by: Vinyl-Davyl <[email protected]>

* update: development

Signed-off-by: Vinyl-Davyl <[email protected]>

---------

Signed-off-by: Vinyl-Davyl <[email protected]>
Signed-off-by: Vinyl-Davyl <[email protected]>

* update: development

Signed-off-by: Vinyl-Davyl <[email protected]>
Signed-off-by: Vinyl-Davyl <[email protected]>

* update: development

Signed-off-by: Vinyl-Davyl <[email protected]>
Signed-off-by: Vinyl-Davyl <[email protected]>

* update: development

Signed-off-by: Vinyl-Davyl <[email protected]>
Signed-off-by: Vinyl-Davyl <[email protected]>

* update: development

Signed-off-by: Vinyl-Davyl <[email protected]>
Signed-off-by: Vinyl-Davyl <[email protected]>

* update: development

Signed-off-by: Vinyl-Davyl <[email protected]>
Signed-off-by: Vinyl-Davyl <[email protected]>

* update: development

Signed-off-by: Vinyl-Davyl <[email protected]>
Signed-off-by: Vinyl-Davyl <[email protected]>

* update: development

Signed-off-by: Vinyl-Davyl <[email protected]>
Signed-off-by: Vinyl-Davyl <[email protected]>

* update development

Signed-off-by: Vinyl-Davyl <[email protected]>
Signed-off-by: Vinyl-Davyl <[email protected]>

* update: development

Signed-off-by: Vinyl-Davyl <[email protected]>
Signed-off-by: Vinyl-Davyl <[email protected]>

* update: development

Signed-off-by: Vinyl-Davyl <[email protected]>
Signed-off-by: Vinyl-Davyl <[email protected]>

* update: development

Signed-off-by: Vinyl-Davyl <[email protected]>
Signed-off-by: Vinyl-Davyl <[email protected]>

* update: development

Signed-off-by: Vinyl-Davyl <[email protected]>
Signed-off-by: Vinyl-Davyl <[email protected]>

* update: development

Signed-off-by: Vinyl-Davyl <[email protected]>
Signed-off-by: Vinyl-Davyl <[email protected]>

* update: development

Signed-off-by: Vinyl-Davyl <[email protected]>
Signed-off-by: Vinyl-Davyl <[email protected]>

* update: development

Signed-off-by: Vinyl-Davyl <[email protected]>
Signed-off-by: Vinyl-Davyl <[email protected]>

* update: development

Signed-off-by: Vinyl-Davyl <[email protected]>
Signed-off-by: Vinyl-Davyl <[email protected]>

* update: development

Signed-off-by: Vinyl-Davyl <[email protected]>
Signed-off-by: Vinyl-Davyl <[email protected]>

* chore: updated contents

Signed-off-by: Vinyl-Davyl <[email protected]>
Signed-off-by: Vinyl-Davyl <[email protected]>

* update: development

Signed-off-by: Vinyl-Davyl <[email protected]>
Signed-off-by: Vinyl-Davyl <[email protected]>

* update: development

Signed-off-by: Vinyl-Davyl <[email protected]>
Signed-off-by: Vinyl-Davyl <[email protected]>

* update: development

Signed-off-by: Vinyl-Davyl <[email protected]>

* update: development

Signed-off-by: Vinyl-Davyl <[email protected]>

* update: development

Signed-off-by: Vinyl-Davyl <[email protected]>

---------

Signed-off-by: Mahesh Patil <[email protected]>
Signed-off-by: Vinyl-Davyl <[email protected]>
Signed-off-by: Vinyl-Davyl <[email protected]>
Co-authored-by: Mahesh Patil <[email protected]>
sanketshevkar pushed a commit that referenced this pull request Sep 3, 2024
* update: development

Signed-off-by: Vinyl-Davyl <[email protected]>
Signed-off-by: Vinyl-Davyl <[email protected]>

* update: development

Signed-off-by: Vinyl-Davyl <[email protected]>
Signed-off-by: Vinyl-Davyl <[email protected]>

* cursor inconsistency in editor fixed (#95)

Signed-off-by: Mahesh Patil <[email protected]>
Signed-off-by: Vinyl-Davyl <[email protected]>

* update(ui): secondary theme color (#93)

* update: development

Signed-off-by: Vinyl-Davyl <[email protected]>

* update: development

Signed-off-by: Vinyl-Davyl <[email protected]>

---------

Signed-off-by: Vinyl-Davyl <[email protected]>
Signed-off-by: Vinyl-Davyl <[email protected]>

* update: development (#97)

Signed-off-by: Vinyl-Davyl <[email protected]>
Signed-off-by: Vinyl-Davyl <[email protected]>

* update: development

Signed-off-by: Vinyl-Davyl <[email protected]>

* update: development

Signed-off-by: Vinyl-Davyl <[email protected]>

* update: development

Signed-off-by: Vinyl-Davyl <[email protected]>

---------

Signed-off-by: Vinyl-Davyl <[email protected]>
Signed-off-by: Vinyl-Davyl <[email protected]>
Signed-off-by: Mahesh Patil <[email protected]>
Co-authored-by: Mahesh Patil <[email protected]>
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.

Editing text is inconsistent/unreliable
2 participants