Skip to content

macOS: fix trigger word input disappearing when typing and on add - #1506

Merged
steipete merged 1 commit into
openclaw:mainfrom
shiv19:fix/trigger-word-mac
Jan 23, 2026
Merged

steipete merged 1 commit into
openclaw:mainfrom
shiv19:fix/trigger-word-mac

Conversation

@shiv19

@shiv19 shiv19 commented Jan 23, 2026

Copy link
Copy Markdown
Contributor

Problem

When clicking "+ Add word" to add a new trigger word in Voice Wake settings, the input box would disappear after a second. Similarly, when editing existing trigger words, characters would disappear as you typed.

Root Cause

The swabbleTriggerWords property has a didSet observer that triggers VoiceWakeRuntime.shared.refresh(), which calls sanitizeVoiceWakeTriggers(). This function filters out empty strings from the array.

During editing:

  1. User types a character → binding updates swabbleTriggerWords[index]
  2. didSet fires → VoiceWakeRuntime.refresh() is called
  3. sanitizeVoiceWakeTriggers() runs and removes the empty entry
  4. SwiftUI re-renders with the sanitized array
  5. The row disappears from view

Solution

Introduced a local @State buffer called triggerEntries that holds the trigger words with stable UUID identifiers. This decouples user input from the AppState synchronization:

  • Local state layer: triggerEntries: [TriggerEntry] where each entry has a UUID id and a value
  • Stable identity: UUIDs persist even as values change, so SwiftUI doesn't lose track of rows
  • Deferred sync: Changes are synced to AppState only on explicit actions:
    • When the view becomes inactive (leaves settings tab)
    • On form submission (Enter key)
    • When removing a word
    • On view disappear

The local state is reloaded when the view becomes active again, ensuring it stays in sync with AppState while preventing mid-edit sanitization.

Testing

Verified that:

  • ✅ Typing in trigger words keeps input visible and responsive
  • ✅ Adding new trigger words works correctly
  • ✅ Editing existing trigger words works correctly
  • ✅ Changes persist when leaving and returning to the settings tab
  • ✅ Reset defaults button works

@shiv19

shiv19 commented Jan 23, 2026

Copy link
Copy Markdown
Contributor Author

I can finally call my clawdbot Sparky on the Mac node.
image

Fixed issue where trigger words would disappear when typing or when adding new trigger words. The problem was that `swabbleTriggerWords` changes were triggering `VoiceWakeRuntime.refresh()` which sanitized the array by removing empty strings in real-time.

Solution: Introduced local `@State` buffer `triggerEntries` with stable UUID identifiers for each trigger word entry. User edits now only affect the local state buffer and are synced back to `AppState` on explicit actions (submit, remove, disappear). This prevents premature sanitization during editing.

The local state is loaded on view appear and when the view becomes active, ensuring it stays in sync with `AppState`.
@shiv19
shiv19 force-pushed the fix/trigger-word-mac branch from 691da61 to 88fecd5 Compare January 23, 2026 11:54
@shiv19

shiv19 commented Jan 23, 2026

Copy link
Copy Markdown
Contributor Author
  • force pushed to fix a linting error, removed an extra new line.

@steipete steipete self-assigned this Jan 23, 2026
@steipete

Copy link
Copy Markdown
Contributor

Thanks, Shiva!

@steipete
steipete merged commit fdbaae6 into openclaw:main Jan 23, 2026
@steipete

Copy link
Copy Markdown
Contributor

Landed via temp rebase onto main.

  • Gate: pnpm lint && pnpm build && CLAWDBOT_TEST_WORKERS=1 CLAWDBOT_TEST_FAST=1 pnpm test
  • Land commit: 0fbf728
  • Merge commit: fdbaae6

Thanks @shiv19!

dustin-olenslager pushed a commit to dustin-olenslager/ironclaw-supreme that referenced this pull request Mar 24, 2026
lovewanwan pushed a commit to lovewanwan/openclaw that referenced this pull request Apr 28, 2026
…enclaw#1506)

Fixed issue where trigger words would disappear when typing or when adding new trigger words. The problem was that `swabbleTriggerWords` changes were triggering `VoiceWakeRuntime.refresh()` which sanitized the array by removing empty strings in real-time.

Solution: Introduced local `@State` buffer `triggerEntries` with stable UUID identifiers for each trigger word entry. User edits now only affect the local state buffer and are synced back to `AppState` on explicit actions (submit, remove, disappear). This prevents premature sanitization during editing.

The local state is loaded on view appear and when the view becomes active, ensuring it stays in sync with `AppState`.
ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
…enclaw#1506)

Fixed issue where trigger words would disappear when typing or when adding new trigger words. The problem was that `swabbleTriggerWords` changes were triggering `VoiceWakeRuntime.refresh()` which sanitized the array by removing empty strings in real-time.

Solution: Introduced local `@State` buffer `triggerEntries` with stable UUID identifiers for each trigger word entry. User edits now only affect the local state buffer and are synced back to `AppState` on explicit actions (submit, remove, disappear). This prevents premature sanitization during editing.

The local state is loaded on view appear and when the view becomes active, ensuring it stays in sync with `AppState`.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026
…enclaw#1506)

Fixed issue where trigger words would disappear when typing or when adding new trigger words. The problem was that `swabbleTriggerWords` changes were triggering `VoiceWakeRuntime.refresh()` which sanitized the array by removing empty strings in real-time.

Solution: Introduced local `@State` buffer `triggerEntries` with stable UUID identifiers for each trigger word entry. User edits now only affect the local state buffer and are synced back to `AppState` on explicit actions (submit, remove, disappear). This prevents premature sanitization during editing.

The local state is loaded on view appear and when the view becomes active, ensuring it stays in sync with `AppState`.
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
zeekay pushed a commit to Dream-AI-4444/bot that referenced this pull request Sep 11, 2026
…enclaw#1506)

Fixed issue where trigger words would disappear when typing or when adding new trigger words. The problem was that `swabbleTriggerWords` changes were triggering `VoiceWakeRuntime.refresh()` which sanitized the array by removing empty strings in real-time.

Solution: Introduced local `@State` buffer `triggerEntries` with stable UUID identifiers for each trigger word entry. User edits now only affect the local state buffer and are synced back to `AppState` on explicit actions (submit, remove, disappear). This prevents premature sanitization during editing.

The local state is loaded on view appear and when the view becomes active, ensuring it stays in sync with `AppState`.
zooqueen pushed a commit to zooqueen/openclaw that referenced this pull request Sep 11, 2026
lhfer pushed a commit to lhfer/openclaw that referenced this pull request Oct 11, 2026
…enclaw#1506)

Fixed issue where trigger words would disappear when typing or when adding new trigger words. The problem was that `swabbleTriggerWords` changes were triggering `VoiceWakeRuntime.refresh()` which sanitized the array by removing empty strings in real-time.

Solution: Introduced local `@State` buffer `triggerEntries` with stable UUID identifiers for each trigger word entry. User edits now only affect the local state buffer and are synced back to `AppState` on explicit actions (submit, remove, disappear). This prevents premature sanitization during editing.

The local state is loaded on view appear and when the view becomes active, ensuring it stays in sync with `AppState`.
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