Today is the 26th of January 2024, and in India, it's Republic Day, so I had a small outing with my Twitter friends. After returning home, I started working on HashX for the hackathon.
Yesterday, I was struggling with implementing authentication in the application, including the sign-in and sign-out flow. After spending more time on it and going through multiple iterations and reading more about Apollo GraphQL, I learned that we can also include a header for individual APIs.
I think this is a much better approach than having global authentication. Since time is limited, I will proceed with this method. I am storing the auth token in the local storage of the Chrome extension and will be sending the token to every API header.
After hours of struggle, it's 3:30 a.m. right now, and everything is working fine. However, there's one issue: whenever I type something in the input box, the entire component re-renders with every letter typed, causing the loading symbol to appear for the user with every keystroke due to an API call happening for some reason. This creates a very poor user experience. If the user pastes the entire token in one go, it works fine, but I don't want this small bug to remain in the application. Let's see if I can solve this by tomorrow. Hoping for the best.