Skip to content

fix(tui): stop writing kv.json on every theme preview keystroke - #29229

Closed
lexlian wants to merge 1 commit into
anomalyco:devfrom
lexlian:fix/tui-theme-kv-28893
Closed

lexlian wants to merge 1 commit into
anomalyco:devfrom
lexlian:fix/tui-theme-kv-28893

Conversation

@lexlian

@lexlian lexlian commented May 25, 2026 •

Copy link
Copy Markdown

Issue for this PR

Closes #28893

Type of change

  • Bug fix

What does this PR do?

The /themes dialog calls theme.set(value) on every cursor move and filter change, which unconditionally writes to kv.json. This causes theme thrashing during preview and potential corruption on abrupt exits.

Added theme.preview(name) which changes the active theme without writing to kv. The dialog uses preview for cursor navigation, filter changes, and cancel-restore, and set only when the user confirms. Also added preview to the TuiTheme plugin interface.

How did you verify your code works?

  • Existing 5 theme-store tests pass
  • Existing 15 plugin-loader tests pass (fixture updated with preview)

Checklist

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

@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. and removed needs:compliance This means the issue will auto-close after 2 hours. labels May 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

Add theme.preview() that changes the active theme without persisting to
kv.json. Use preview() for cursor movement and filter changes in the
theme dialog, set() only on confirm. Cancel restores via preview()
instead of set(), avoiding unnecessary writes on every keystroke (anomalyco#28893).
@lexlian
lexlian force-pushed the fix/tui-theme-kv-28893 branch from 4ffc3c9 to f09566d Compare June 1, 2026 05:25
@github-actions

Copy link
Copy Markdown
Contributor

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

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.

fix(tui): /themes dialog writes kv.json on every preview keystroke and on cancel

1 participant