Skip to content

fix(app): repair malformed persisted tabs - #39645

Merged
Brendonovich merged 2 commits into
anomalyco:devfrom
OpeOginni:fix-tab-hydration
Jul 30, 2026
Merged

fix(app): repair malformed persisted tabs#39645
Brendonovich merged 2 commits into
anomalyco:devfrom
OpeOginni:fix-tab-hydration

Conversation

@OpeOginni

@OpeOginni OpeOginni commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Issue for this PR

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

  • Filters null and malformed entries while persisted tabs are hydrated.
  • Keeps valid session and draft tabs, including legacy tabs that need the fallback server.
  • Prevents desktop startup crashes when tab consumers read the type field.

Possible Inputs:

null
// => []

[null]
// => []

[{ type: "session", sessionId: "abc" }]
// => [{ type: "session", sessionId: "abc", server: fallback }]

[{ type: "session", server: null, sessionId: "abc" }]
// => []

[{ type: "session", server: "local", sessionId: "abc" }]
// => preserved

[{ type: "draft", server: "local", draftID: "1" }]
// => removed because directory is missing

[{ type: "unknown", server: "local" }]
// => []

How did you verify your code works?

  • Ran bun test --preload ./happydom.ts ./src/context/tabs.test.ts from packages/app.
  • Ran bun typecheck from packages/app.
  • Added regression coverage for null entries, malformed tabs, invalid top-level data, and legacy tabs.

Screenshots / recordings

  • Not applicable; this changes persisted-state hydration without changing the UI.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@Brendonovich
Brendonovich merged commit ac53806 into anomalyco:dev Jul 30, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Crash on desktop startup from null persisted tab

2 participants