Skip to content

Comments

fix: Removing a recipe ingredient doesn't remove its links to steps#6896

Open
RoSh-23 wants to merge 2 commits intomealie-recipes:mealie-nextfrom
RoSh-23:issue_3956
Open

fix: Removing a recipe ingredient doesn't remove its links to steps#6896
RoSh-23 wants to merge 2 commits intomealie-recipes:mealie-nextfrom
RoSh-23:issue_3956

Conversation

@RoSh-23
Copy link

@RoSh-23 RoSh-23 commented Jan 19, 2026

What this PR does / why we need it:

  1. Goal: To fix the issue [BUG] - Removing a recipe ingredient doesn't remove its links to steps #3956.
  2. Changes made:
    • recipe_service.py: added a method which checks for non-existent references and removes them, called it inside "update_one"
    • test_recipe_crud.py: added a test method, which mimicks the issue and verfies the expected result.
  3. Decisions made:
    • Fixed the recipe_service.py to prevent bad data from getting inserted, as suggested earlier by @michael-genson, by checking the non-existent references and removing them, before updating.
    • Did a small trade-off, saw the approach used by an earlier fix attempt, which made database call, I avoided any database calls since they were not required here.

Which issue(s) this PR fixes:

#3956

Special notes for your reviewer:

  • Hi @hay-kot, @michael-genson, This is my first open source contribution, I would like to thank you and all the contributors for making this project open-source and providing developers around the world opportunity to learn and contribute.
  • Really grateful for the team for setting up developer containers which made the process very smooth.
  • Have added explanatory comments to the code.

Testing

  • Wrote a test method in test_recipe_crud.py namely "test_update_with_non_existent_ingredient_references" to mimick the issue, ran it and it passed.
  • Ran various scenarios from the UI and verified them through the JSON.

@RoSh-23 RoSh-23 changed the title Issue 3956 fix: Removing a recipe ingredient doesn't remove its links to steps Jan 19, 2026
@RoSh-23
Copy link
Author

RoSh-23 commented Jan 19, 2026

Hi @michael-genson, @hay-kot
Kindly provide the approval for the workflows to run.

@RoSh-23 RoSh-23 marked this pull request as draft January 19, 2026 23:55
@RoSh-23 RoSh-23 marked this pull request as ready for review January 19, 2026 23:55
@RoSh-23
Copy link
Author

RoSh-23 commented Jan 20, 2026

Hi @hay-kot @michael-genson It is still showing 2 workflows that require approval.

@Kuchenpirat
Copy link
Collaborator

Workflows need manual approving by a maintainer for first time contributors which usually happens when we start reviewing the PR.
Did approve your pr workflow so we can see if everything goes through.

@RoSh-23
Copy link
Author

RoSh-23 commented Jan 22, 2026

Hello @Kuchenpirat, @hay-kot, @michael-genson
All checks have passed, Is it possible to review this PR now?, really looking forward to any responses, feedback etc. Thanks

@michael-genson
Copy link
Collaborator

We have a pretty large backlog of PRs to get through, we will get to yours once we have time. Appreciate your patience!

@RoSh-23
Copy link
Author

RoSh-23 commented Jan 22, 2026

We have a pretty large backlog of PRs to get through, we will get to yours once we have time. Appreciate your patience!

Really understand that, Thanks for this reply.

@RoSh-23
Copy link
Author

RoSh-23 commented Feb 14, 2026

Hi @michael-genson, @hay-kot, @Kuchenpirat Can this PR be reviewed now?, really looking forward to any feedback...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants