Skip to content

fix: typing issue fix while entering artifact name#256

Merged
betterclever merged 1 commit intomainfrom
@krishna9358/artifact-typing-fix
Feb 5, 2026
Merged

fix: typing issue fix while entering artifact name#256
betterclever merged 1 commit intomainfrom
@krishna9358/artifact-typing-fix

Conversation

@krishna9358
Copy link
Contributor

Summary

The cursor was jumping to the end of the input field after each keystroke. This is a classic React controlled input issue where the parent component's state update caused a re-render that reset the cursor position.

  • Added localValue state - The input now uses a local state variable (localValue) for its value attribute instead of directly using the prop value. This ensures React preserves the cursor position during synchronous state updates.
  • Smart sync logic - The useEffect only syncs the parent's value prop to localValue when it's genuinely different (i.e., external changes like switching nodes or resetting). This prevents the cursor from jumping when the parent echoes back the same value we just sent via onChange.
  • Immediate parent updates - The handleInputChange function updates both the local state and calls the parent's onChange immediately, keeping data in sync while preventing cursor issues.

Testing

  • bun run test
  • bun run lint
  • bun run typecheck
  • Additional notes:

Documentation

  • Updated the relevant doc(s) (see docs/guide.md) or checked that no updates are needed.
  • Recorded contract/architecture changes in both public docs and .ai logs when applicable.

Signed-off-by: Krishna Mohan <krishanmohank974@gmail.com>
@chatgpt-codex-connector
Copy link

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@betterclever betterclever merged commit b1f9856 into main Feb 5, 2026
3 checks passed
@LuD1161 LuD1161 deleted the @krishna9358/artifact-typing-fix branch February 12, 2026 22:35
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