-
Notifications
You must be signed in to change notification settings - Fork 1
Stop obscuring deleted recipes in Generate Similar RecipeCardList #206
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
base: main
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
I don't know what I'm looking at but I'm glad it fixes things. |
|
Can you elaborate on this? Or perhaps demonstrate this to me? Thanks. |
| <RecipeCard | ||
| recipe={recipe} | ||
| onDelete={handleOnDelete} | ||
| onDelete={onDelete || handleOnDelete} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I understand. Thanks for the detailed explanation.
So line 56 will decide whether or not to use the "empty" version of handling deletion? If the "empty" version was not provided, use the "real" version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's correct.
If we don't provide an onDelete when rendering a RecipeCardList, we'll pass the real one (handleOnDelete) to the RecipeCards.
It's not the most elegant fix. But doing it this way ensures that even though the two RecipeCardLists are on the /account/recipes page, we can give a different behaviour to the RecipeCardList used in the Generate Similar Recipes use case.
When we migrate the Generate Similar Recipes parts of /account/recipes to the generate folder, we won't have to do this and can instead program it the way we do the other generation scenarios
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, looks good. Thanks!
I've updated the issue so we can log all of the changes that have been made and need to be "undone". In the event that there are more changes that affect Generate Similar due to its location, we can add those to the list in this issue: #198


This fixes #205
This is the default onDelete prop passed to Recipe Cards when a RecipeCardList renders recipe cards:
AIChefBot/components/RecipeCardList.js
Lines 28 to 36 in ada5eb9
AIChefBot/components/RecipeCardList.js
Lines 54 to 60 in b8e28ee
onHandleDelete() obscures deleted recipes from the RecipeCardList, so the onDelete prop is only used when on the /account/recipes.js:
AIChefBot/components/RecipeCard.js
Lines 110 to 116 in b8e28ee
This is useful when a user deletes recipes from their Saved Recipes list.
However, recipes.js renders a second RecipeCardList because it also hosts the Generate Similar Recipes use case:
We don't want this RecipeCardList to pass handleOneDelete() to its RecipeCards.
Changes