Troubleshooting User-Friend Search Function: Debugging, Data Structure and Filter Adjustments

In this meeting, the State Changers discussed refining a code to improve functionality based on user input. The focus was on creating and tweaking an endpoint in an API used to fetch a list of "friends" associated with a certain user ID, with an optional search term to filter the list.


The discussion identified a problem where the endpoint was not functioning as expected when a search term was entered. Debugging highlighted data structure issues, specifically the formation of an array of arrays, which was causing failures when running tests with text formatting. By redefining the array structure and adjusting the add-on, the State Changers were able to correct the anomaly and run successful tests. The endpoint was adjusted to check the length of the search term and update based on the presence or absence of this search term. The group decided to use case sensitivity, though they acknowledged this could have limitations if used with non-Western languages. The meeting concluded with a reminder that data structures often cause problems, and using debug options can help identify these insidious issues. The honed code now fetches the appropriate list of friends and allows for a filtered search based on provided terms.


(Source: Office Hours 8/22/2023 )

State Change Members Can View The Video Here
chris-montgomery-smgTvepind4-unsplash.jpg

View This Video Now

Join State Change Risk-Free