fix(desktop): keep the retired page open action when healing page links

IS
1mo ago
+43-1

What & why

Fixes #8153.

#7962 replaced the single pageOpenAction preference with a pageLinks tier map, but nothing migrated the stored value. healV2UserPreferences fills pageLinks from defaults, so anyone who had customized "Pages" under Browser settings lost it when they updated to 1.33 or later. The old value sits in localStorage and nothing reads it.

Now, when a stored row has pageOpenAction and no pageLinks, the old action becomes the cmd-click tier of pageLinks. Before #7962 every terminal click on a page link ran pageOpenAction whatever the modifier. I kept it on cmd-click only, because binding plain click would change what an ordinary click does on every page link. If the old value was the default pane, the result equals today's default. Once pageLinks is stored, heal ignores the legacy field.

This can't help users who changed any preference after updating. That write persisted pageLinks with defaults.

How I tested it

  • Three cases in schema.test.ts: the legacy value carries over, it's ignored once pageLinks exists, and an unknown value falls back to defaults. The first fails without the fix.
  • bun test on the file passes (46). biome check on both files and bun run typecheck in apps/desktop are clean.
  • I hit this myself. After updating, my localStorage row still had "pageOpenAction": "external" and no pageLinks.

No UI change, so no screenshots.

Checklist

  • PR title follows conventional commits (type(scope): subject)
  • bun run lint and bun run typecheck pass (CI fails on lint warnings too)
  • "Allow edits from maintainers" is checked on fork PRs

🤖 Generated with Claude Code


Summary by cubic

Fixes #8153, where users who customized the "Pages" open action before 1.33 lost that setting on update because healV2UserPreferences never migrated the retired pageOpenAction preference.

Bug Fixes

  • When a stored row has pageOpenAction and no pageLinks, the old action becomes the cmd-click tier of pageLinks, leaving plain-click behavior unchanged.
  • Unknown legacy values fall back to defaults.
  • Legacy value is ignored once pageLinks is stored.

Summary by CodeRabbit

  • Bug Fixes
    • Existing page-opening preferences are now retained during settings updates. Legacy preferences without saved page-link settings continue using their prior valid action for metadata pages, while other page types use current defaults.
    • Preferences with saved page-link settings remain intact, and unrecognized legacy actions fall back to the default settings.