Skip to content

fix(sync): keep retry usable and show partial sync results - #123

Open
mfagundez-4geeks wants to merge 1 commit into
masterfrom
fix/sync-notification-retry-semantics
Open

fix(sync): keep retry usable and show partial sync results#123
mfagundez-4geeks wants to merge 1 commit into
masterfrom
fix/sync-notification-retry-semantics

Conversation

@mfagundez-4geeks

Copy link
Copy Markdown
Contributor

⚠️ Frontend half of the sync fixes. Needs learnpack-cli #262.

Problems

  • On a rejected /accept, the store forced the notification back to pending locally while the server held another state, so the card looked retryable when it was not.
  • The AI generation consumable was spent before calling /accept, so every rejected retry burned one.
  • Any failure showed "the synchronization took too long", whatever the real cause.

Fix

  • Reload the real state from the server instead of guessing it.
  • Spend the consumable only after the server accepts the sync.
  • Give a 409 (sync already running) its own message.
  • Support the new partial status: the card stays actionable and names the languages that failed.

Files

store.tsx, syncNotifications.ts, storeTypes.ts, SyncNotificationCard.tsx, locales/{en,es}.json

Three problems around a failed synchronization:

- When /accept was rejected the store forced the notification back to
  "pending" locally while the server kept it in another state, so the
  card looked retryable when it was not. It now reloads the real state
  from the server instead of guessing it.
- The AI generation consumable was spent before calling /accept, so
  every rejected retry burned one. It is now spent only after the
  server accepted the sync.
- A 409 (a sync already running) is told apart from an actual failure
  and gets its own message, which needs the API helper to carry the
  HTTP status and error code.

The card also understands the new "partial" status: it stays actionable
with a Retry button, and it reports which languages failed instead of
always blaming a timeout.
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