Skip to content

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

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

fix(tui): stop writing kv.json on every theme preview keystroke#29229
lexlian wants to merge 1 commit into
anomalyco:devfrom
lexlian:fix/tui-theme-kv-28893

Conversation

@lexlian
Copy link
Copy Markdown

@lexlian lexlian commented May 25, 2026

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

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).
@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. 👍

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.

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

1 participant