Skip to content

Conversation

balajis-qb
Copy link
Contributor

@balajis-qb balajis-qb commented Oct 14, 2025

Description

Removed the debounce in the docs-site example editor so react-live no longer resets the cursor position while typing. This ensures smooth, predictable typing behavior in the live code editor.

Problem
As a part of enabling the support for TypeScript examples in the docs-site, we make react-live to be a controlled component so that we can able to use the updated code for JSX transpilation when user switches to the JavaScript tab. We debounce onChange handler. But with debounce enabled, react-live occasionally re-renders out of sync during typing, which auto-resets the cursor/selection position mid-input.

Changes

  • Removed debounce from the example editor’s onChange handling in docs-site/src/components/Example/index.tsx.
  • Allowed immediate updates to the live code preview to avoid selection jumps.
  • Verified typing continuity and cursor stability during rapid input.

Screenshots

The issue
https://github.com/user-attachments/assets/d8d0d6b5-7838-4213-af69-c7356161b7a7

After the fix
https://github.com/user-attachments/assets/a1965261-b2fc-4e84-97e5-715f60cd34de

Contribution checklist

  • I have followed the contributing guidelines.
  • I have formatted my code with Prettier and checked for linting issues with ESLint for code readability.

- Resolved the cursor position reset issue while typing in progress
Copy link

codecov bot commented Oct 14, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.29%. Comparing base (13f83bb) to head (f06c925).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5922   +/-   ##
=======================================
  Coverage   97.29%   97.29%           
=======================================
  Files          30       30           
  Lines        3470     3470           
  Branches     1473     1457   -16     
=======================================
  Hits         3376     3376           
  Misses         94       94           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@martijnrusschen martijnrusschen merged commit 34d879f into Hacker0x01:main Oct 14, 2025
6 checks passed
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.

2 participants