Skip to content

fix: clear the mail draft error and ignore stale loads - #99

Open
nvtoan0201-swe wants to merge 1 commit into
CopilotKit:mainfrom
nvtoan0201-swe:fix/mail-drafts-error
Open

nvtoan0201-swe wants to merge 1 commit into
CopilotKit:mainfrom
nvtoan0201-swe:fix/mail-drafts-error

Conversation

@nvtoan0201-swe

Copy link
Copy Markdown

What changed

The MailScreen drafts loader had two issues:

  • The error state was never cleared. A banner from a failed load stayed on screen after the server recovered and a later load succeeded.
  • There was no active guard, so a slow /api/drafts response could overwrite newer drafts (last-resolved wins).

The effect now clears the error before loading, ignores responses after unmount/supersession, and matches the pattern already used by CalendarScreen and the other loaders in apps/mobile/src/screens.tsx.

Verification

  • pnpm test — 276 pass, 0 fail
  • pnpm lint
  • pnpm typecheck (root + mobile)

No simulator/device run; the change is limited to the effect lifecycle in one screen.

Integration limits

Component lifecycle behavior is not covered by the repo's node:test helpers (they cover pure modules); this mirrors the existing screen loaders.

AI assistance was used to prepare this change; I reviewed the code and ran the checks above.

The MailScreen drafts effect never cleared its error, so a banner from a past failure stayed after a later load succeeded. It also had no active guard, so a slow response could overwrite newer drafts. Clear the error before loading and ignore responses from an unmounted or superseded effect, matching the other data loaders in the file.

This branch has not been deployed

No deployments
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