Skip to content

fix(launcher): prevent crash when exiting AI context view with active accessory - #1046

Merged
Xoshbin merged 1 commit into
mainfrom
fix/search-header-accessory-exit-crash
Nov 14, 2026
Merged

Xoshbin merged 1 commit into
mainfrom
fix/search-header-accessory-exit-crash

Conversation

@Xoshbin

@Xoshbin Xoshbin commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner

Guard the options and value prop getters on SearchBarAccessoryDropdown
in SearchHeader.svelte against accessory becoming null mid-flush.

When leaving the AI chat view (entered via Tab context mode) with Backspace
or Escape, activeContext and activeView are cleared in the same
synchronous tick. Because SearchHeader precedes ExtensionViewContainer
in the component tree, switching from .context-search-row to
.search-input-row mounts the {:else} branch's SearchBarAccessoryDropdown
before ExtensionViewContainer's unmount cleanup clears
searchBarAccessoryService.active, causing the dropdown's queued $effect
to dereference null.options and trip the root <svelte:boundary>.

What changed

  • Before (issue / current behavior):
  • After (fix / new behavior):

Affected areas

  • Launcher UI / UX (visuals, interactions, keyboard shortcuts, settings)
  • SDK / Extensions (asyar-sdk, extension runtime, IPC contracts, manifest)
  • Rust Backend / Platform (Tauri commands, search, storage, OS integration)
  • Docs / Tooling / Other (docs, CI, build scripts, locales)

Manual smoke test & Validation

  • I manually smoke-tested this in the running app (pnpm dev) and visually verified the fix/feature works.

AI usage

  • AI tools helped produce this change.
  • I ran the asyar-contribution skill (.agents/skills/asyar-contribution/SKILL.md), followed it, and reviewed every generated line.

Boundaries

  • Zero-hardcoded-strings i18n policy respected (if UI strings were added/changed).
  • Third-party extension compatibility preserved (no breaking changes to published extension contracts without deprecation/boundary adapter).
  • Hot paths remain fast and unblocked (window reveal, keystroke search, and 120 FPS UI responsiveness).
  • pnpm check:ci (or the relevant inner-loop checks) passes locally.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed an issue when exiting context mode while an extension view is closing. The context accessory row is now removed, the regular search input is restored, and stale accessory text is cleared without causing an error.

… accessory

Guard the `options` and `value` prop getters on `SearchBarAccessoryDropdown`
in `SearchHeader.svelte` against `accessory` becoming `null` mid-flush.

When leaving the AI chat view (entered via Tab context mode) with Backspace
or Escape, `activeContext` and `activeView` are cleared in the same
synchronous tick. Because `SearchHeader` precedes `ExtensionViewContainer`
in the component tree, switching from `.context-search-row` to
`.search-input-row` mounts the `{:else}` branch's `SearchBarAccessoryDropdown`
before `ExtensionViewContainer`'s unmount cleanup clears
`searchBarAccessoryService.active`, causing the dropdown's queued `$effect`
to dereference `null.options` and trip the root `<svelte:boundary>`.
@coderabbitai

coderabbitai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The search header now uses empty dropdown values when accessory data is nullish. A regression test covers context deactivation and navigation in one Svelte flush, and verifies that the accessory row is removed while the standard search-input row remains.

Changes

Search accessory teardown

Layer / File(s) Summary
Null-safe accessory transition and regression coverage
asyar-launcher/src/components/layout/SearchHeader.svelte, asyar-launcher/src/components/layout/SearchHeader.test.ts
The dropdown uses empty options and an empty value when accessory data or its properties are nullish. The regression test verifies that clearing the accessory during context deactivation and navigation does not throw, removes the accessory row, and restores the standard search-input row.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: bennocrafter

Merge Risk: Minimal · up to 0b218

This fixes a crash when leaving AI context view with an active accessory. The change is small and local, and no merge-blocking risk is evident.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the fix (preventing a crash) and the specific context (exiting the AI context view while an accessory is active). The PR objectives describe a guard on the SearchBarAccessoryDropdown o…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the fix (preventing a crash) and the specific context (exiting the AI context view while an accessory is active). The PR objectives describe a guard on the SearchBarAccessoryDropdown options and value getters in SearchHeader.svelte, which matches this crash-prevention fix. The title is specific and does not list files. It covers the main change, though it omits the getter-guard detail.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 7647b24 and 0b218fb.

Files selected for processing: 2

  • asyar-launcher/src/components/layout/SearchHeader.svelte
  • asyar-launcher/src/components/layout/SearchHeader.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

@Xoshbin
Xoshbin merged commit f9cc06e into main Nov 14, 2026
10 checks passed
@Xoshbin
Xoshbin deleted the fix/search-header-accessory-exit-crash branch November 14, 2026 06:41
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