Skip to content

Categories: don't store a stand-in colour - #298

Merged
Musiker15 merged 2 commits into
mainfrom
fix/category-color-unset
Oct 29, 2026
Merged

Musiker15 merged 2 commits into
mainfrom
fix/category-color-unset

Conversation

@Musiker15

Copy link
Copy Markdown
Member

Problem

The category form showed a missing colour as #4ea426 and sent that value on save. Any category without a colour got one the next time the list was saved, for example after renaming another category, and from then on the public hub drew a dot for it. A colour could also never be removed again.

Fix

  • Stored categories without a colour get an empty colour field. The field uses the existing optional mode of ColorField with the hint "Leave empty for no color".
  • An empty or blank field is saved as null.
  • New categories still start with the green default, which can now be cleared.
  • The legend dot is only drawn when the row has a valid colour.
  • Rows and payload moved into components/categories/category-rows.ts. Hint text in all seven languages.

Existing data is unchanged: a category that already got #4ea426 this way can't be told apart from one that picked it on purpose. The guild can clear it now.

Tests

  • category-rows.test.ts: a category without colour round-trips without colour, a cleared field becomes null, names are trimmed and order follows position.
  • Counter-check: with the old fallback in both places, 2 of 3 tests fail.
  • pnpm --filter @msk-forms/web typecheck, eslint and prettier on the changed files.

The category form filled a missing colour with the stand-in #4ea426 and
saved it, so every category that had no colour got one on the next save
and a dot appeared for it on the public hub.

Stored categories without a colour now show an empty colour field, the
field is optional ("Leave empty for no color"), and an empty field is
saved as null. New categories still start with the green default. Rows
and payload moved into category-rows.ts so the round trip is tested.
@Musiker15
Musiker15 merged commit 28b3637 into main Oct 29, 2026
4 checks passed
@Musiker15
Musiker15 deleted the fix/category-color-unset branch October 29, 2026 06:13
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.

1 participant