Skip to content

Conversation

yoichiro
Copy link
Collaborator

@yoichiro yoichiro commented Jul 1, 2025

Summary

  • Fix input content reset issue in Breadboard editor component
  • Add useRef to track current file ID for proper state management
  • Prevent unnecessary local state updates during Redux state synchronization

Problem

Users experienced input content disappearing while typing in the Breadboard editor. This occurred due to:

  1. Local state being reset when Redux state updated
  2. Timing conflicts between user input and debounced save operations
  3. Monaco Editor's controlled component behavior causing content loss

Solution

  • Added currentFileRef to track the currently selected file ID
  • Modified useEffect to only update local state when a different file is selected
  • Preserved user input during same-file editing sessions
  • Maintained existing debounced save functionality

Test plan

  • Verify typing in editor no longer causes content to disappear
  • Confirm file switching still works correctly
  • Test debounced save functionality remains intact
  • Check multiple rapid file switches work properly

🤖 Generated with Claude Code

- Add useRef to track current file ID in WorkbenchSourceCodeEditor
- Only update local state when different file is selected
- Prevent local state reset during Redux state updates for same file
- Fixes issue where user input would disappear during typing

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@yoichiro yoichiro merged commit 8c24a12 into main Jul 1, 2025
1 check passed
@yoichiro yoichiro deleted the fix-breadboard-editor-input-reset branch July 1, 2025 04:19
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.

1 participant