Skip to content

Remove unnecessary enum variants from apps/desktop/src-tauri/src/store.rs #3553

@yujonglee

Description

@yujonglee

Problem

https://github.com/fastrepl/hyprnote/blob/6aae2567ce934bc372adce4e01f047e11a952447/apps/desktop/src-tauri/src/store.rs#L4-L11

From the list above, only TinybaseValues and the Onboarding-related variants are actually needed. The others are redundant.

Occasionally, the onboarding state must be accessed from the Rust side. The remaining variants are frontend-only and can be merged into TinybaseValues.

For each added enum variant, we end up introducing a significant amount of boilerplate, for example:

Additionally, one-off load/store logic is required alongside the generated bindings:

In practice, we can simply leverage the TinybaseValues variant. Load/save is already handled by the TinyBase persister:

Why Things Are Getting Worse

Previously, I believed DismissedToasts should not be part of StoreKey. After introducing TinybaseValues, this became even clearer, and a refactor was obviously needed. However, I did not follow through, nor did I document this as code comments.

As a result:

  1. AI agents tend to follow existing patterns.
  2. Contributors with less familiarity with the codebase maintenance model generate non-ideal code with AI.
  3. AI helps us move fast—but also helps us generate bad code faster.

Recent examples:

Solution

The upside is that AI can also help us fix this faster. This issue can be fed directly to an agent, and also serve as shared context for other contributors.

#3553 (comment)

Other Resources

This situation strongly echoes what Mitchell said about feature design.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

In progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions