mealie icon indicating copy to clipboard operation
mealie copied to clipboard

[v1.0.0b] - Rating is discarded if recipe is edited upon creating

Open epheterson opened this issue 2 years ago • 2 comments

First Check

  • [X] This is not a feature request
  • [X] I added a very descriptive title to this issue.
  • [X] I used the GitHub search to find a similar issue and didn't find it.
  • [X] I searched the Mealie documentation, with the integrated search.
  • [X] I already read the docs and didn't find an answer.

What is the issue you are experiencing?

When creating a new recipe via URL, if you also edit that recipe (adding tags, categories, etc...) then the rating is discarded. If you do not edit the recipe, the rating does stick.

These steps reproduce every time:

  1. Import new recipe via URL
  2. On initial recipe presentation, add rating
  3. Click Edit, add tags, categories, etc...
  4. Click Save

Rating will not have saved.

It also reproduces if you add the rating during the add step, i.e.

  1. Import new recipe via URL
  2. On initial recipe presentation, click Edit, add tags, categories, etc...
  3. Add rating
  4. Click Save

Deployment

Docker (Synology)

Deployment Details

**Details**
Version: v1.0.0beta-3
Build: 56eb0bca7142715984c8028c4c881f086e979564
Application Mode: Production
Demo Status: Not Demo
API Port: 9000
API Docs: Enabled
Database Type: sqlite
Recipe Scraper Version: 14.3.0

**Checks**
Secure Site: Yes
Server Side Base URL: Yes
LDAP Ready: No
Email Configured: No
Docker Volumes: success

epheterson avatar Jun 16 '22 01:06 epheterson

As a workaround, while adding recipes, this flow preserves the rating:

  1. Import new recipe via URL
  2. On initial recipe presentation, click Edit, add tags, categories, etc...
  3. Click Save
  4. Add Rating

epheterson avatar Jun 16 '22 02:06 epheterson

Ignore my last comment, I see the problem.

When you set the rating, the frontend immediately sends a PATCH request to the API to update it. However, when you save a recipe in the frontend, it sends a PUT request with the old value. In the case of this specific issue, the PUT is overwriting the user's rating with null (since there is no previous rating).

This is repeatable at any stage, even for existing recipes:

  1. open a recipe for editing
  2. change the rating (e.g. 4 --> 5)
  3. save the recipe
  4. refresh the page and observe that the rating didn't change (e.g. it's still 4)

michael-genson avatar Jun 16 '22 17:06 michael-genson