Skip to content

Refactor TextInputNode to move history management to ViewModel#39

Merged
Aaronontheweb merged 1 commit intodevfrom
feature/refactor-textinput-history-to-viewmodel
Dec 16, 2025
Merged

Refactor TextInputNode to move history management to ViewModel#39
Aaronontheweb merged 1 commit intodevfrom
feature/refactor-textinput-history-to-viewmodel

Conversation

@Aaronontheweb
Copy link
Owner

Summary

  • Remove built-in history from TextInputNode which was causing disposal issues when used in reactive layouts
  • TextInputNode is now a pure UI component handling text editing only
  • Up/Down arrows return false to let ViewModel handle history navigation
  • Enter no longer auto-clears text; added Clear() method for ViewModel to call
  • Add Page Up/Down scrolling support to StreamingTextNode
  • Fix streaming demo: move history management to StreamingChatViewModel
  • Fix reactive layout disposal bug by using static input panel
  • Add comprehensive TextInputNode unit tests

Background

The TextInputNode was storing input history internally, but this caused issues when the node was used inside a ReactiveLayoutNode. When the layout rebuilt (e.g., when IsGenerating changed), the old PanelNode was disposed, which cascaded to dispose the shared TextInputNode, losing all history and breaking input.

The fix moves history management to the ViewModel where it belongs - this follows proper separation of concerns and allows the application to control whether history is enabled, how many entries to keep, and whether to persist it.

Test plan

  • All existing tests pass (374 tests)
  • New TextInputNodeTests cover cursor movement, editing, and event firing
  • Manual testing: Run streaming demo, submit multiple prompts, verify Up/Down navigates history

- Remove built-in history from TextInputNode (was causing disposal issues
  when used in reactive layouts)
- TextInputNode is now a pure UI component handling text editing only
- Up/Down arrows return false to let ViewModel handle history navigation
- Enter no longer auto-clears text; added Clear() method for ViewModel to call
- Add Page Up/Down scrolling support to StreamingTextNode
- Fix streaming demo: move history management to StreamingChatViewModel
- Fix reactive layout disposal bug by using static input panel
- Add comprehensive TextInputNode unit tests
@Aaronontheweb Aaronontheweb merged commit 1c17944 into dev Dec 16, 2025
6 checks passed
@Aaronontheweb Aaronontheweb deleted the feature/refactor-textinput-history-to-viewmodel branch December 16, 2025 03:52
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