Skip to content

fix(web): keep the daily summary settings when they fail to load - #15246

Merged
aryanorastar merged 2 commits into
BasedHardware:mainfrom
jitendravjh:fix/web-daily-summary-hour-reset
Sep 22, 2026
Merged

aryanorastar merged 2 commits into
BasedHardware:mainfrom
jitendravjh:fix/web-daily-summary-hour-reset

Conversation

@jitendravjh

@jitendravjh jitendravjh commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #15245

The settings page keeps the daily summary as not loaded when the fetch fails, instead of falling back to on at 22:00, so the toggle stays disabled and nothing is saved until the real settings arrive. Same shape as the vocabulary list in #15244.

Added src/components/settings/__tests__/SettingsDailySummary.test.tsx, fails on main (it saves hour 22) and passes now.

Failure-Class: none

Review in cubic

@Git-on-my-level

Copy link
Copy Markdown
Member

Verified against main — this closes the exact data-loss path from #15245, and the fix carries the regression tests the repo's Definition of Done asks for. Thanks!

  • web/app/src/components/settings/SettingsPage.tsx — dailySummary state now starts as null and the account-section load uses getDailySummarySettings().catch(() => null) instead of fabricating { enabled: true, hour: 22 }, so a failed fetch can no longer masquerade as real preferences. Both write paths (handleDailySummaryToggle, handleDailySummaryHourChange) bail while the settings are unknown — that is what actually stops the toggle from PATCHing hour 22 over the user's delivery time, since updateDailySummarySettings sends the whole object. The Toggle component already supports disabled, so the control is inert while unloaded, and HourPicker's non-null value is only reachable inside the dailySummary?.enabled branch — null-safe end to end. Same shape as the vocabulary fix in fix(web): keep the vocabulary list when it failed to load #15244, which keeps the section consistent.
  • web/app/src/components/settings/__tests__/SettingsDailySummary.test.tsx — real behavioral coverage through the mocked @/lib/api seam: a rejected load results in no save at all, and toggling off preserves the loaded hour 7 in the PATCH payload. Follows the existing SettingsTrainingData.test.tsx conventions; CI on this head ran it in the web-app-checks lane with both tests green (typecheck included).

Minor, non-blocking: while the settings are unavailable the row renders a silently disabled toggle — a "could not load" hint like the vocabulary section's three-way state would make the reason discoverable. Feel free to fold that in or skip it.

Checks pass on this head; no auth, workflow, or dependency surfaces touched. Leaving for routine human maintainer merge review.

🤖 Automated review on behalf of the maintainers.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@Git-on-my-level Git-on-my-level added web positive-signal Automation verified a genuine fix/quality contribution labels Sep 20, 2026

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Web fix: same shape as #15244 — daily summary settings now stay null (not-loaded) on fetch failure instead of a hardcoded default that could silently overwrite the user's real delivery time on next save. New component test covers load-failure and toggle-preserves-delivery-time. CI green. Confidence 5/5.

@jitendravjh
jitendravjh force-pushed the fix/web-daily-summary-hour-reset branch from 4fc63b9 to e7f2e55 Compare September 21, 2026 15:35

@aryanorastar aryanorastar left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed current head e7f2e556e006. origin/main still defaults a failed daily-summary load to { enabled: true, hour: 22 }, which overwrites the user's settings. This SHA keeps the last known settings and pins it. Hygiene SUCCESS. Not merging.

@aryanorastar
aryanorastar merged commit ddc619c into BasedHardware:main Sep 22, 2026
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

positive-signal Automation verified a genuine fix/quality contribution web

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bounty proposal] fix(web): toggling the daily summary can reset its delivery time ($25 proposed)

4 participants