Open YodaDaCoda opened 4 months ago
I discovered this when the Mealient app for Android wouldn't display one of my recipes after editing it. While I do think Mealient should handle this situation more gracefully, Mealie should avoid this in the first place.
kirmanak/Mealient#284
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Can this be re-opened?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I tried to figure out how to do this some weeks ago but couldn't see a clear path where I might make changes. Happy to try again with some direction?
You'll probably want to add a check in the recipe service upon updating to remove any ingredient links for non-existent ingredients:
https://github.com/mealie-recipes/mealie/blob/mealie-next/mealie/services/recipe/recipe_service.py
Hey @michael-genson, can I work on this issue?
@shethshlok for sure! Generally anyone is welcome to work on any issue
Thanks @michael-genson, I had a question for you, I added a function in the recipe_service.py that checks for invalid reference ids in instructions and removes them from db, although I have to manually refresh the page to see the changes, considering this I also have to make changes to the fronted too? Updating the state?
I would have to see the context to answer that question, I would recommend opening a PR with your solution.
Generally we shouldn't be implementing cleanup solutions and instead should fix the service so it doesn't create bad data, then running a one-time database fix to clean up the existing bad data.
First Check
What is the issue you are experiencing?
When a recipe ingredient is removed from the recipe, any recipe-step links for that ingredient are not removed from the steps.
Steps to Reproduce
ingredientReferences
on the step without a correspondingrecipeIngredient
.Please provide relevant logs
N/A
Mealie Version
v1.10.2
Deployment
Docker (Linux)
Additional Deployment Details
No response