ChickenKyiv / recipe-search-react

We're replicating advanced search for recipe based projects
https://modest-shannon-513067.netlify.com/
1 stars 3 forks source link

clean up our component, related to displaying search options, that we picked after each submit button click #55

Closed atherdon closed 6 years ago

atherdon commented 6 years ago

it's not important but will improve our workflow

chauhannishith commented 6 years ago

You mean display the whole recipe?

atherdon commented 6 years ago

i mean test section, sorry for bad clarification - i think i should go and sleep. recipe planner

chauhannishith commented 6 years ago

Do you want me to turn these into links to full recipe? or give more control to browse through results?

atherdon commented 6 years ago

not for now. we'll have a separated page for displaying recipe search results, but i'll work on RecipeComponent at separated repo, so don't want to take your time on working at same things.


I think this component is displayed only values from our form fields or it displaying raw data from server response too? if yes - then clean only values from form fields after form submit

On 07-Jun-2018 at 01:00 PM, chauhannishith wrote:

Do you want me to turn these into links to full recipe? or give more control to browse through results?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ChickenKyiv/recipe-search-react/issues/55#issuecomment-395411404, or mute the thread https://github.com/notifications/unsubscribe-auth/ABZrDs9sk930hPitiMA0vL7evqXmXrCbks5t6SPSgaJpZM4UeWcq .

chauhannishith commented 6 years ago

I can't figure out why resetting the selected values is causing the whole page to refresh. If we continue to use this then the fetched recipes stored in the state also get lost. I tried passing null value but that also doesn't work so I think it is better to keep as it is and serve it as criteria selected by users instead of displaying separately

atherdon commented 6 years ago

i think this is because of our react knowledge. i'm pretty sure that someway it can be done easily. maybe you have an ideas how to crack this problem?

JorgeRodr commented 6 years ago

Hi guys, if I understood well the issue, the problem is that we want to clean the form after every click on the search button right? I have never use the ant design select before but in another libraries they use to have a method to clean the inputs. However,I have nos found anything for the antd selects. I think that another way to solve this problem is to use the componentDidUpdate method of react instead of the onChange method in the selects. When we call the setState method form the parent component it don't trigger the onChange method of the select because we don't interact with the component, I think.

nickisaacs commented 6 years ago

@atherdon I've added a fix for your issue. The problem was passedRecipes was undefined/reset and therefore componentWillReceiveProps was setting the Test.js state with an undefined value. I've added a check to update the state only if the props contained actual data. https://github.com/ChickenKyiv/recipe-search-react/pull/65

Note: I occasionally get the "401 Unauthorised" response for the search requests. Once it starts, it doesn't fix itself until a page refresh.

atherdon commented 6 years ago

Thank you @JorgeRodr & @nickisaacs !

@nickisaacs i think it's an issue related to edamam free api plan that we're using. But i create a separated task #66, so we'll be able to take a look on it later. and thanks for your fix.

And this issue is closed.