Skip to content

fix: guard session_diff with Array.isArray() + WIP browser panel#21094

Closed
pvldmitriev wants to merge 1 commit intoanomalyco:devfrom
pvldmitriev:fix/diffs-array-guard-and-browser-wip
Closed

fix: guard session_diff with Array.isArray() + WIP browser panel#21094
pvldmitriev wants to merge 1 commit intoanomalyco:devfrom
pvldmitriev:fix/diffs-array-guard-and-browser-wip

Conversation

@pvldmitriev
Copy link
Copy Markdown

Summary

  • Fix crash: TypeError: e.diffs.map is not a function — replaced ?? [] with Array.isArray() guards across all session_diff consumers (5 files). Root cause: SolidJS reconcile() can return {} instead of [] for non-wrappable initial state, and ?? [] doesn't catch truthy non-arrays.
  • WIP browser panel: Tauri webview child commands (create, close, navigate, resize, back/forward/reload), browser UI panel with tabs, platform API bridge, layout integration.
  • Rust fixes: Fixed type errors in browser.rs (or_else closures), removed unimplemented get_browser_url from specta commands.

Files changed

Crash fix (Array.isArray guards)

  • packages/app/src/components/prompt-input.tsx
  • packages/app/src/context/global-sync/event-reducer.ts
  • packages/app/src/pages/session.tsx
  • packages/app/src/pages/session/session-side-panel.tsx
  • packages/app/src/pages/session/use-session-commands.tsx

WIP browser panel

  • packages/app/src/components/browser/native-browser.tsx (new)
  • packages/app/src/pages/session/browser-panel.tsx (new)
  • packages/desktop/src-tauri/src/browser.rs (new)
  • packages/desktop/src-tauri/src/lib.rs
  • packages/desktop/src/index.tsx
  • packages/desktop/src/bindings.ts
  • packages/app/src/context/layout.tsx
  • packages/app/src/context/platform.tsx

Test plan

  • bun typecheck — 13/13 packages pass
  • bun run test:unit (packages/app) — 299 pass, 0 fail
  • Desktop app launches without diffs.map crash
  • CI checks pass on self-hosted runner

🤖 Generated with Claude Code

@github-actions github-actions bot added needs:compliance This means the issue will auto-close after 2 hours. needs:issue labels Apr 5, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 5, 2026

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 5, 2026

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 5, 2026

The following comment was made by an LLM, it may be inaccurate:

Found potentially related PRs:

  1. PR fix: add defensive checks for undefined values in diff handling #19261: "fix: add defensive checks for undefined values in diff handling"

  2. PR fix(web): harden session diffs handling and support local asset override #19266: "fix(web): harden session diffs handling and support local asset override"

These PRs may address overlapping issues with session diff handling and type safety, though they appear to be from an earlier phase. Your current PR (21094) appears to be the latest comprehensive fix with Array.isArray guards.

…sh + WIP browser panel

The desktop app crashed with "TypeError: e.diffs.map is not a function" because
session_diff store could hold non-array values (e.g. {} from reconcile() edge cases).
Replaced all `?? []` guards with `Array.isArray()` checks across 5 files.

Also includes WIP browser panel feature: Tauri webview commands, browser UI panel,
platform API, layout integration, and Rust browser.rs module with fixed type errors.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@pvldmitriev pvldmitriev force-pushed the fix/diffs-array-guard-and-browser-wip branch from ec20703 to 7756294 Compare April 5, 2026 10:48
@pvldmitriev pvldmitriev closed this Apr 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs:compliance This means the issue will auto-close after 2 hours. needs:issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants