[React]Debugging component render/states for a specific case

Hi everyone,

I have a bug in my form which only appear when a specific condition is met. To be more specific, I work with an Api which is a loop for now. Something like this :

data 1 => data 2 => data 3 => data 3 => data 1 => data 2 => data 3 => …

If my form is data 3 and we are in this loop state :

I submit my form => data 1 is loaded => data 2 is loaded => I come back to my form.

When I come back to my form component, I want all my component states to be reinitialize but only half of it do so.

To summary, I would like something like this :

But instead I got this :

In other cases, the component works just fine. So I think maybe it is a problem with when my states are updated. But I don’t know for now where is the bug origin.

What are the first things I need to check when there is a bug like this ? Or do you know of some ways I could test my component to find the bug origin ? I admit I am just a rookie and for me, it is the first time I have something so subtle to debug alone (because I do not have anyone specialize in React working with me).:sweat_smile:

Its helpful if you can provide a link to your code or a snippet of where you think the problem might be. The first would be preferable.

Thank you for your reply. :blush:

I can show you my code but in fact I am working with a custom and private API which is only working on my computer and my coworker computer for now. So I need to recreate the API behavior if I want to show you the problem. I will try to do so this week-end and I hope I will be able to make it works (as I am not as experience as my coworker and as I do not know if my back end and programming knowledge is enough to make it. But I will do my best anyways.:muscle:).

First thing first, I am sorry to reply this late but I was sicked this weekend until the beginning of this week.

Secondly, after meeting with my boss, he told me it is okay if I don’t debug it because the API will not do a loop in the near future.

So I am closing thread. Thanks everyone and sorry to have bothered you with this.