Skip to content

fix(setting): persist inline edits of enum values - #11071

Open
MichaelUray wants to merge 1 commit into
hcengineering:developfrom
MichaelUray:fix/enum-value-edit
Open

MichaelUray wants to merge 1 commit into
hcengineering:developfrom
MichaelUray:fix/enum-value-edit

Conversation

@MichaelUray

Copy link
Copy Markdown
Contributor

Fixes #9063

Problem

Editing the text of an existing value in Settings → Enums was lost. EnumValuesList dispatches update on blur/Enter, but EnumValues only listened to remove and drop, so an edit was only persisted by a later drag and drop.

Changes

  • EnumValues handles update and stores the edited list.
  • Edited values are trimmed; empty or duplicate values are rejected like when adding a value, and the list reverts to the stored values.
  • The list works on a local copy, so the live-query document is no longer mutated in place. Drag and drop saves from the same copy.

Tests

  • New enumValuesUtils.test.ts for the validation helper.
  • Manual: edit a value and reload; edit to empty / to a duplicate (reverts); reorder, add and delete still work.

Editing an existing value in Settings > Enums was only kept locally: EnumValuesList dispatches 'update' on blur/Enter, but EnumValues did not listen to it, so the change was only saved by a later drag and drop.

EnumValues now handles 'update' and stores the edited values. Edited values are trimmed and, like adding a value, empty or duplicate values are rejected and the list is reverted to the stored values. The list works on a local copy so the stored document is no longer mutated in place.

Fixes hcengineering#9063

Signed-off-by: Michael Uray <michaeluray@users.noreply.github.com>

This branch has not been deployed

No deployments
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.

Editing an Enum-Entry in Settings-Enums doesn't work.

1 participant