Closed kpunno closed 7 months ago
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
ai-chef-bot | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Apr 9, 2024 8:59pm |
I see the issue. Looking at it now. It's making some real spaghetti trying to use RecipeCard over these two contexts. Making things graceful becomes more difficult as we add more features.
@rjwignar
I see the issue. Looking at it now. It's making some real spaghetti trying to use RecipeCard over these two contexts. Making things graceful becomes more difficult as we add more features.
@rjwignar
I agree :/. Perhaps we can modify that if statement to execute only if there's a _id
property AND there's no cache (maybe we can check this using getCache().
I'm not completely familiar with the caching code yet, but if there's a way we could do the above we could try and out and see how it works out
@rjwignar
Solution using URL path to determine what the context is... Check it out.
@rjwignar
Solution using URL path to determine what the context is... Check it out.
Clever solution @kpunno...I like it.
When testing I found one more bug, similar to the original bug your PR tackles. If a user removes a recipe they just saved and refresh/return to their cache, the UI will suggest that recipe is still saved even though it's been removed:
This can be misleading to users. To fix this, we just need to update the cache when a recipe is unsaved.
@rjwignar
Nice, makes sense. I pushed a fix. Remove the recipe id from the cache when the recipe is unsaved... Thanks for your keen eyes.
Fixes #159
Modified cacheing such that the cache will update when a recipe is saved.
The cached recipe will receive an _id property which is detected when recipe cards are generated, thus giving the recipe card knowledge that this recipe has been saved.