Our sweet GSOC family literally coded the summer away with some of the best developers from around the world always ready to hold our hand in case we loose balance. Now the hardest week has come. Its time to say goodbye and I am not able to get over it. The end is getting closer as you read this but my heart is not designed to close the best doors so easily. My brain is full of brand new ideas to implement after the GSOC timeline. For now lets check out my latest patches which got merged this week.
What did I do this week?
We made a decision that we should polish and test the existing features before adding new ones so that we can find and fix bugs if any.
Result? We ended up making a list of 13 bugs. 😂
User authentication was the first thing I completed but I could still access the protected routes in the UI although some of them were not working because of the absence of the JWT token in the cookies. Still we had to maintain the user session on the client side as well.
I created a global state using createContext
in React so that we can update the state when the user logs in to our system. I allowed users to access the protected routes by checking against this state. Users would be redirected to the login page in case they are not authenticated. Solved?
Not yet. Another corner case got us thinking. If we reload the page then the state is lost and user is logged out. It would be a terrible user experience to force the user to login every time they may refresh the page because of connection issues on their side.
This time I stored the state in localStorage
so that we can save state across page refresh. Security was maintained by our httpOnly
cookie.
This was solved but now users could vote more than once. Imagine allowing this in real government elections of your country.
Result? You may get the same president every time. 😂
Everyone may not like that right? (Trump smiling secretly 😝)
This was a simple fix by introducing a new state variable and updating it if the user has already voted for a story. You press again and your vote gets removed.
My mentor and I spent some time in trying to fix our httpOnly
cookie attributes to work with the latest updates in Chrome. However, none
of our solution worked in Chrome because Chrome was probably upset with us and did not set the sameSite
attribute of the cookie to none
.
We ended up creating a new sub-domain for our server so that the request is no longer a cross-origin one. 😂
Now some smart users were able to edit stories of others. Imagine editing and filling your friends stories with shit. 😂
Devesh (my awesome GSOC partner) saved all F.R.I.E.N.D.S here by updating the client side with a minor fix. Thankfully our server did not betray us here.
Then came my killer move. A full end-to-end test. Yes, I was able to complete a long test in Cypress to test all our main functionality like login, home page, creating new stories, editing them, commenting and even replying on comments. This will save a lot of time in the future by eliminating the need of manually testing all functionality before merging every patch. We may also consider running this test in the CI soon.
What is coming up next?
This is officially the last week of GSOC’20. I will make a final report for my project and get it reviewed from my awesome mentors.
I will extend my Cypress test to cover signup, notifications and logout functionality.
Finishing touches also make a great impact. I will add some decorations for the final celebration and release to production (heaven for developers). 🎉
Did I get stuck anywhere?
I firmly believe that as a developer if you are not stuck then you have not seen enough.
Some corner case bugs were a pain point. I also got stuck when trying to handle multiple cases for filters and pagination. It was a bit tricky to identify the points of optimization for enhancement of user experience but that gave me the real development experience. 🙂
My never give up attitude helped me to fly high above all obstacles to fix all bugs we identified till now.
Time flew and brought us close to the end. I honestly hate saying that and decided not to say a goodbye. Its that simple. Sometimes the best things deserve to be a special part of your life and EOS had already made its place in my heart long back. Loads of 💖 to my EOS family.
Cheers to a new beginning. Its not the end.
Signing off. Aditya Sharma.