Gatsby site Dark mode toggle not working as expected

I am working on a project of making a digital routine website for online classes. I used gatsby for that .The site is hosted on netlify.
The problem I am facing is :
When I load the site in dark mode ,the dark mode toggle button doesnt work for the first two clicks.Then it works normally.
I dont face any issue when I am using local dev server.The plugin I used for dark mode use localstorage.

My site link : Digital Routine

Github repo : mte19project