Skip to content

fix: persist habits and pomodoro state in localstorage (#304)#342

Open
nitishchaubeyy wants to merge 4 commits into
indresh404:mainfrom
nitishchaubeyy:fix/codingowl-state-persistence
Open

fix: persist habits and pomodoro state in localstorage (#304)#342
nitishchaubeyy wants to merge 4 commits into
indresh404:mainfrom
nitishchaubeyy:fix/codingowl-state-persistence

Conversation

@nitishchaubeyy
Copy link
Copy Markdown
Contributor

Description

This PR resolves #304 by ensuring that user progress in the CodingOwl component is persisted across page refreshes and navigation. Previously, all state was held in volatile useState hooks, causing data loss whenever the component unmounted.

Key Changes

Habit Persistence: Implemented lazy initialization and useEffect syncs for the habit checklist, ensuring completion status is saved and hydrated via localStorage.

Pomodoro Resilience: Transitioned the timer logic from a simple timeLeft state to an endTime timestamp-based calculation. This allows the timer to seamlessly resume countdowns even if the user refreshes the page or navigates away.

State Recovery: Added cleanup logic to clear expired session storage, ensuring the timer resets correctly after completion.

Fixes #304

@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ranker-hub Error Error Jun 6, 2026 10:54am

@github-actions github-actions Bot added bug Something isn't working enhancement New feature or request frontend Frontend related changes (HTML/CSS/JS/React) gssoc GirlScript Summer of Code gssoc26 GirlScript Summer of Code 2026 nsoc NSoC NSoC'26 NSoC 2026 pending-review PR is pending review labels Jun 6, 2026
@indresh404
Copy link
Copy Markdown
Owner

If your PR still shows the old failed Vercel check, please rebase (or merge the latest main branch into your branch) and push again to trigger a fresh deployment/check run.

@nitishchaubeyy
Copy link
Copy Markdown
Contributor Author

Hey @indresh404, I synced the branch with the latest main and pushed again to trigger the deployment. I also ran npm run build and npm run lint locally, and everything compiles perfectly without any errors on my end.

Since I don't have access to the Vercel logs, could you please check if it's failing due to a missing Environment Variable or a caching issue on Vercel's end?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request frontend Frontend related changes (HTML/CSS/JS/React) gssoc GirlScript Summer of Code gssoc26 GirlScript Summer of Code 2026 nsoc NSoC NSoC'26 NSoC 2026 pending-review PR is pending review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: CodingOwl Streaks Checklist & Pomodoro Session Volatility

2 participants