Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] - Deleting recipe notes doesn't work #2756

Closed
6 tasks done
p0lycarpio opened this issue Nov 25, 2023 · 1 comment · Fixed by #2759
Closed
6 tasks done

[BUG] - Deleting recipe notes doesn't work #2756

p0lycarpio opened this issue Nov 25, 2023 · 1 comment · Fixed by #2759
Labels
bug: confirmed bug Something isn't working

Comments

@p0lycarpio
Copy link
Contributor

First Check

  • This is not a feature request.
  • I added a very descriptive title to this issue.
  • I used the GitHub search to find a similar issue and didn't find it.
  • I searched the Mealie documentation, with the integrated search.
  • I already read the docs and didn't find an answer.
  • This issue can be replicated on the demo site (https://demo.mealie.io/).

What is the issue you are experiencing?

Deleting one or all recipe notes (at the bottom of the RecipePage, after the instructions) does not work after reloading the page.

The list is updated in the frontend, and a PUT request is made to the API with the empty Notes[] array but the update does not seem to be happening in the database. After reloading, we find the note(s) that had to be deleted. The database or backend doesn't seem to take into account the empty array...

Steps to Reproduce

  1. Edit a recipe and add 1 or 2 notes.
  2. Save recipe and reload this page. Note(s) are here.
  3. Re-edit this recipe and delete all the notes.
  4. Save the recipe. Notes appear to have been deleted.
  5. Reload recipe page. Notice that the notes have reappeared

Please provide relevant logs

[11/25/23 13:59:15] INFO     127.0.0.1:0 - "GET                                                                       httptools_impl.py:506
                             /api/media/recipes/84999a1b-8e00-4e6b-b347-eb934bbb99b5/images/original.webp?rnd=1&versi                      
                             on=fV90 HTTP/1.1" 200                                                                                         
[11/25/23 13:59:16] INFO     127.0.0.1:0 - "GET /api/foods?page=1&perPage=-1&orderBy=name&orderDirection=asc          httptools_impl.py:506
                             HTTP/1.1" 200                                                                                                 
[11/25/23 13:59:17] INFO     127.0.0.1:0 - "GET /api/units?page=1&perPage=-1&orderBy=name&orderDirection=asc          httptools_impl.py:506
                             HTTP/1.1" 200                                                                                                 
                    INFO     127.0.0.1:0 - "GET                                                                       httptools_impl.py:506
                             /api/organizers/categories?page=1&perPage=-1&orderBy=name&orderDirection=asc HTTP/1.1"                        
                             200                                                                                                           
                    INFO     127.0.0.1:0 - "GET                                                                       httptools_impl.py:506
                             /api/organizers/categories?page=1&perPage=-1&orderBy=name&orderDirection=asc HTTP/1.1"                        
                             200                                                                                                           
                    INFO     127.0.0.1:0 - "GET                                                                       httptools_impl.py:506
                             /api/organizers/tags?page=1&perPage=-1&orderBy=name&orderDirection=asc HTTP/1.1" 200                          
                    INFO     127.0.0.1:0 - "GET                                                                       httptools_impl.py:506
                             /api/organizers/tags?page=1&perPage=-1&orderBy=name&orderDirection=asc HTTP/1.1" 200                          
[11/25/23 13:59:32] INFO     127.0.0.1:0 - "PUT /api/recipes/perfect-pumpkin-pie HTTP/1.1" 200                        httptools_impl.py:506
[11/25/23 13:59:32] INFO     3 changes detected                                                                                 main.py:286
                    INFO     127.0.0.1:0 - "GET /api/recipes/perfect-pumpkin-pie/comments HTTP/1.1" 200               httptools_impl.py:506

I printed the notes data in update_one() method (line 340 in mealie/services/recipe/recipe_service.py) :

def update_one(self, slug: str, update_data: Recipe) -> Recipe:
    recipe = self._pre_update_check(slug, update_data)

    print("update_data:", update_data.notes)
    new_data = self.repos.recipes.update(slug, update_data)
    print("returned new_data : ", new_data.notes)
    self.check_assets(new_data, recipe.slug)
    return new_data

Result:

update_data: []
<mealie.db.models.recipe.recipe.RecipeModel object at 0x7fd5a6bf5330>
returned new_data : [RecipeNote(title='Note 1', text='abc'), RecipeNote(title='Note 2', text='def')]

Mealie Version

Latest, nightly

Deployment

Docker (Linux)

Additional Deployment Details

No response

@michael-genson
Copy link
Collaborator

Thanks for this! I opened a PR to fix it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug: confirmed bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants