DEV Community


Posted on

Collab Lab Week 6 - A wild infinite loop

Apparently, this has happened in every cohort so far but I had the distinction of pushing code that caused us to hit the daily read limit on Firestore.

box of shame

I am grateful for every mistake and difficulty I've faced as part of this team. I felt bad for making the team wait to access our data but other than a little waiting, no one was hurt. I didn't cost anyone a lot of money with my mistake.

I keep saying this, and I'll continue to say it. These are the great conditions for making mistakes and learning from them. It's real enough that I care about the job I'm doing, but there's a safety net. No mistake I make will be catastrophic.

I will relive my shame and share the offending code. Maybe I'll save someone else from the same kind of error. Can you spot the issue?

The useEffect block was the offender and wasn't needed at all. I was refactoring the code using a hook our mentor Steve provided and failed to notice the infinite fetching of the Firebase data. At some point, there were all these different state variables passing the token around between the app and localStorage. I'm much happier with how the token works now. There is one source of truth.

I swear I'm not doing it on purpose, but I do appreciate all the learning by mistakes I'm getting in with The Collab Lab. Everything about this has been a stretch and a learning experience.

As great as everything is, there is a downside. No one gets paid for doing this (our mentors are volunteers🙏🏾) and it feels like work. At the end of eight weeks (maybe nine?) I will have learned a lot, grown as a developer, and leave with better communication skills than I came in with. I will also be happy that a good thing has come to an end.

Buy Me A Coffee

Top comments (0)