Skip to content

Migrate to use redux-remember instead of redux-persist#4379

Open
zehata wants to merge 3 commits into
nusmodifications:masterfrom
zehata:redux-remember
Open

Migrate to use redux-remember instead of redux-persist#4379
zehata wants to merge 3 commits into
nusmodifications:masterfrom
zehata:redux-remember

Conversation

@zehata
Copy link
Copy Markdown
Contributor

@zehata zehata commented Mar 31, 2026

Context

redux-persist is last committed to in 2021.
Objectively speaking, this is adding technical debt dating back to 2020: 4b484cf.

// FIXME: Remove the next line when _persist is optional again.
// Cause: https://github.com/rt2zz/redux-persist/pull/919
// Issue: https://github.com/rt2zz/redux-persist/pull/1170
// eslint-disable-next-line no-underscore-dangle, @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain

// FIXME: Remove the next line when _persist is optional again.
// Cause: https://github.com/rt2zz/redux-persist/pull/919
// Issue: https://github.com/rt2zz/redux-persist/pull/1170
// eslint-disable-next-line no-underscore-dangle, @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain

// FIXME: Remove the next line when _persist is optional again.
// Cause: https://github.com/rt2zz/redux-persist/pull/919
// Issue: https://github.com/rt2zz/redux-persist/pull/1170
// eslint-disable-next-line no-underscore-dangle, @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain

With the push to move towards agentic involvement, #4314, there may be a need to migrate over to a more recent solution.

To be quite honest, I didn't spend too long looking for an alternative, and redux-remember is the only one I have found. You should try looking for alternatives to redux-persist and redux-remember to decide if this is a prudent replacement.

Implementation

WIP

Note that I am not removing the redux-persist key-values in localStorage, just in case something goes wrong and we need to rollback. It will be trivial to remove in a future PR, perhaps along with the migration code.

Other Information

Obviously, with such a fundamental change to how we are storing user data, I think it is only prudent if we wait until the end of the semester.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Mar 31, 2026

PR author is not in the allowed authors list.

@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 31, 2026

@zehata is attempting to deploy a commit to the modsbot's projects Team on Vercel.

A member of the Team first needs to authorize it.

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 31, 2026

Codecov Report

❌ Patch coverage is 56.75676% with 32 lines in your changes missing coverage. Please review.
✅ Project coverage is 56.26%. Comparing base (988c6fd) to head (bf55ef9).
⚠️ Report is 220 commits behind head on master.

Files with missing lines Patch % Lines
website/src/reducers/timetables.ts 42.85% 8 Missing ⚠️
website/src/entry/App.tsx 0.00% 6 Missing ⚠️
website/src/bootstrapping/configure-store.ts 55.55% 4 Missing ⚠️
website/src/reducers/reduxRemember.ts 42.85% 4 Missing ⚠️
website/src/storage/index.ts 72.72% 3 Missing ⚠️
...e/src/bootstrapping/migrate-persist-to-remember.ts 71.42% 2 Missing ⚠️
website/src/entry/main.tsx 0.00% 2 Missing ⚠️
website/src/entry/export/main.tsx 0.00% 1 Missing ⚠️
website/src/middlewares/state-sync-middleware.ts 0.00% 1 Missing ⚠️
website/src/reducers/moduleBank.ts 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4379      +/-   ##
==========================================
+ Coverage   54.52%   56.26%   +1.74%     
==========================================
  Files         274      310      +36     
  Lines        6076     6981     +905     
  Branches     1455     1689     +234     
==========================================
+ Hits         3313     3928     +615     
- Misses       2763     3053     +290     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@zehata zehata marked this pull request as draft March 31, 2026 09:34
zehata added 2 commits March 31, 2026 19:16
- Previous state during rehydration is not the default state, but rather the rehydrated state itself
@zehata zehata marked this pull request as ready for review March 31, 2026 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant