Skip to content

Desktop: Integer configuration settings do not enforce min / max value validation on their very first change #12419

Closed
@mrjo118

Description

@mrjo118

Operating system

Windows

Joplin version

2.3.12

Desktop version info

No response

Current behaviour

On Joplin desktop, it is possible to enter invalid values for integer configurations settings in the UI. Integer configuration settings do not enforce min / max value validation on the very first change to the individual setting, i.e. where the setting is not currently present in the settings.json file. After the value is present in settings.json, then subsequent saves to that setting will correctly cap to the min / max values.

This is a historic bug. A potential solution would be to implement the validation in a similar way to the mobile app, which will suppress updating the state for the configuration setting when an invalid value is entered.

Reproduction steps:

  1. Start Joplin on a fresh installation (joplin-desktop dir deleted)
  2. Go to tools, general, appearance, change 'editor font size' to 0 and save it
  3. Observe that the value in settings.json is stored as 0 (the minimum value is not enforced)
  4. Restart Joplin
  5. Go to tools, general, appearance, change 'editor font size' to 1 and save it
  6. Observe that the value in settings.json is stored as 4 (the minimum value is correctly enforced)

Expected behaviour

The minimum value should be enforced on save, even when the setting is not currently present in settings.json

Logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIt's a bug

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions