Skip to content

[Bug]: Saving an edited meal without changes can change its values #1466

Open

Description

@Gr3q

Description

Editing a meal feels unreliable. Values change after opening the edit screen and saving without touching anything, and blank fields behave inconsistently (between micro and macronutrients). Plus combining this with the behavior around changing the base quantity makes the edit page UX feel really unpredictable.

Steps to reproduce

Case A: change nothing at all

  1. Create a custom meal. Set the nutrition base quantity to 30 g and energy to 7 kcal (carbs/fat/protein optional). Save. The app stores 7 × (100 ÷ 30) = 23.33… kcal per 100 g internally.
  2. Open this meal in the edit screen. The energy field now shows 23.3 (rounded for display).
  3. Change nothing. Hit Save.
  4. The meal now stores 23.3 kcal — the original 23.33… is gone.

Context: I know this exact case feels not that important but it showcases that the entire edit form behavior is unpredictable, sometimes invisible to a user.

Case B: imperial units setting

  1. With units set to imperial, create a custom meal with meal size 100 g.
  2. Open it in the edit screen — the size shows 3.53 oz (rounded).
  3. Change nothing. Hit Save.
  4. The meal size is now stored as 100.07 g.

Case C: change one field

  1. Open a custom meal, change only the base quantity from 100 g to 50 g, leave everything else untouched, save.
  2. Values I never typed (e.g. sugars) are now rescaled — 5 g became 10 g (visible on the meal page).

Case D: blank macro field is different than a blank micro field

  1. Open a custom meal that has kcal + macros, edit any field, leave fat blank, save.
  2. Fat is gone.

Expected behaviour

Opening the edit screen and saving without changing anything must leave the meal exactly as it was — regardless of which fields are filled or empty, and regardless of metric/imperial or kcal/kJ settings. A field I didn't touch should keep its value.

I'm undecided on what a blank field should do. What I know:

  • it should be consistent for every field
  • it should either be communicated to the user or it should be obvious what happens when a field is left blank (or changed to blank)

Actual behaviour

Values are rounded to what the form displays and saved back, so precision is lost on a no-op save (Cases A/B). Untouched values get rescaled when the base quantity changes (Case C). Blank kcal/carbs/fat/protein erase their stored value, while blank sugar/fiber/sodium etc. keep theirs — two different meanings of the same blank field (Case D).

Platform

Android

OS version

Android 12

App version

2.5.0

Install source

GitHub Release

Feature area

Custom meals

Screenshots / recordings

No response

Logs or stack trace

Additional context

Possibly related to #506. Micronutrient values have had several past bugs (#1152, #716 — wrong units/display), so I'm unsure whether the values I see after editing are the ones I stored.

Checklist

  • I have searched existing issues and this is not a duplicate
  • I am reporting a bug in OpenNutriTracker, not a third-party food database entry error

Activity

  1. added
    bugSomething isn't working
    on Oct 25, 2026
  2. Gr3q commented on Oct 25, 2026

    @Gr3q
    Author

    just a note, maybe my Case C is intentional on your end, in that case just dismiss it. But for me it's terrible UX that trips me up every time I change/edit values in a different order compared to top/bottom (and I almost always start with filling out calories/macro for some reason).

    Edit: and I can't provide a screenshot to Case A and Case B because it's not visible in the UI, I just dug at the code a bit after I was trying to pin down why the edit page feels hard to use and unpredictable.

  3. added a commit that references this issue on Oct 26, 2026
    4869dc8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions