Closed kshitij430 closed 1 year ago
@kshitij430 is attempting to deploy a commit to the RDS-Team Team on Vercel.
A member of the Team first needs to authorize it.
Please add description to the PR related to why it was happening and how it was fixed
Please add description to the PR related to why it was happening and how it was fixed
Already Done. Can you please review it?
Could you add video to showcase the issue being resolved in different scenarios please @kshitij430
I have added a video considering where no results are found and where 1 or more are found. Now since I did not have any tasks assigned to me I replicated the behavior by duplicating the response as you can see in the video.
From contract , response can't be null or undefined or some error? If we have proper error handling ,we are good with merging
From contract , response can't be null or undefined or some error? If we have proper error handling ,we are good with merging
I doubt the API will give a null or undefined but In cases if the response might be null or undefined. It is better to check if there is a required response present and then update the state for tasks. In a scenario if there is an error the jsx return will handle it.
This PR fixes issue https://github.com/Real-Dev-Squad/website-status/issues/375
There were two issues . 1) The Mine component was re evaluating in a loop as the useEffect hook had "response" as dependency. 2) The if condition to check if there is a response with length had a not condition which did the opposite. Ex - for 0 results found !0 would evaluate to 1 and !1 would evaluate to a falsy value due to which the setTasks state updating function was not getting executed.
Fixes I have done - 1) Removed response as a dependency as we only want to call the API once when the component is mounted. 2) Removed the condition to check response results as these checks are already done in the JSX return. Ex-> display no results found if length is 0 and otherwise.