I have the following function which is called by other component. But it keeps going into an infinite loop, and I dont seem to understand why is that happening.
The f