You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] prefsStore.onRehydrateStorage callback is dead code — new notification types added to the codebase are never enabled by default for existing users #129
The notification system is listed as shipped in the current roadmap. mergeNotificationDefaults exists precisely to ensure that when a new notification type (e.g., PROOF_TIMEOUT) is added, existing users who upgrade get that type enabled rather than silently missing notifications. But the onRehydrateStorage callback that calls mergeNotificationDefaults is wired incorrectly for Zustand v4's API and never executes.
Zustand v4's persist middleware calls onRehydrateStorage with (state) => void, not with () => (state, error) => void. The outer () => returns a function, but Zustand v4 calls the return value with only state, not (state, error). The inner function is therefore invoked as (persisted) where persisted is the state and error is always undefined — but the outer arrow function is the one actually registered, and its body (return (persisted, error) => {...}) is simply returning a function that Zustand ignores. The setState call never runs.
The fix is to use the Zustand v4 signature directly:
The fix is a Zustand API subtlety; the test in prefsStore.test.ts must verify the actual post-rehydration store state, not just that the function was called.
Confirm the onRehydrateStorage signature against the installed Zustand version (package.json) to use the correct form.
After the fix, run the existing prefsStore.test.ts — it likely passes vacuously because the dead code never ran before.
Acceptance Criteria
After rehydration with a stored notificationPrefs that is missing the PROOF_TIMEOUT key, the store contains PROOF_TIMEOUT: true.
After rehydration with a stored notificationPrefs that has REWARD_CONFIRMED: false, that preference is preserved (not overwritten by defaults).
prefsStore.test.ts has explicit assertions for both cases above.
No other onRehydrateStorage side effects are introduced.
Hello Maintainer, I've reviewed this issue thoroughly and I'm well positioned to resolve it — experienced across the relevant stack and comfortable navigating the existing codebase. Ready to start right away.
Activity
chidii commentedon Aug 26, 2026
Hello Maintainer, I've reviewed this issue thoroughly and I'm well positioned to resolve it — experienced across the relevant stack and comfortable navigating the existing codebase. Ready to start right away.
grantfox-oss commentedon Aug 26, 2026
🦊 GrantFox — @chidii has been assigned to this issue as part of the Third Campaign campaign!
Next steps:
Closes #129)Good luck! Track your progress on GrantFox.
test: add hydration-level coverage for onRehydrateStorage (ecotask-ne…
test: add hydration-level coverage for onRehydrateStorage (#129) (#143)
grantfox-oss commentedon Aug 30, 2026
🎉 This issue has been marked as completed on GrantFox as part of the Third Campaign campaign!
@chidii's PR #143 was approved and merged by @cybermax4200.
🏆 @chidii: You earned 40 FoxPoints for this contribution! Your current tier: Builder (1,145 total points). Track your full progress on GrantFox.
👏 Great work, @chidii! Keep contributing to ecotask-network.