My debugging process in the broadest terms goes something like this: Identify the problem, identify possible causes, find the cause(s) of the problem, identify possible solutions, choose and implement a solution, repeat.
The bug I’ll be discussing involved re-rendering a value on my html page. The application was supposed to work as follows: the user clicks a button after filling out a form to make a ‘building’, then a JS event listener sends the information from the form to create a ‘building’ object in rails and JS and render the object on the page. At the same time it should add the cost of the building to a running tally kept by a ‘property’ object the building belongs to, and render the new tally on the page in place of an old value.
The building object was being created and running properly, but the tally was not updating properly. I would add a building to a property and see no change in the cost tally. Then I would remove the building and the cost would update to what it should have been with the building. I could add or remove a building and again the cost would update, but to the value it should have been one change before. Refreshing the page would always give me the correct values.
Thanks for reading this post, I hope it was enlightening!