Persist events in IndexedDB events store with sent flag#617
Persist events in IndexedDB events store with sent flag#617narumincho merged 10 commits intomainfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 96c2afffc2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| pub async fn load_event_binaries() -> Result<Vec<Vec<u8>>, JsValue> { | ||
| let records = load_event_records().await?; | ||
| Ok(records.into_iter().map(|record| record.event_binary).collect()) |
There was a problem hiding this comment.
Exclude unsent records when hydrating cached event binaries
load_event_binaries currently returns every stored record, including Queued/Failed entries, and this cache is used to rebuild event_cache during client startup (definy-client/src/lib.rs) when SSR data is unavailable. In that path, queued/failed local events are treated as normal timeline events, so projections and evaluations can include events the server never accepted after a reload. Filter this to LocalEventStatus::Sent before returning binaries.
Useful? React with 👍 / 👎.
| crate::app_state::upsert_local_event_record(&mut next, record); | ||
| next | ||
| })); | ||
| dialog_close(); |
There was a problem hiding this comment.
Keep account dialog open unless the event is actually sent
post_event_with_queue returns Ok(record) for queued and failed submissions as well as successful ones, so this unconditional dialog_close() path dismisses account creation even when the request got a non-2xx response or failed to reach the server (with force_offline == false). That makes failures look like success and removes immediate retry feedback. Close only on record.status == Sent (or show explicit queued/failed state).
Useful? React with 👍 / 👎.
Summary
eventsobject store instead ofevent_send_queueTesting