Skip to content

Persist events in IndexedDB events store with sent flag#617

Merged
narumincho merged 10 commits intomainfrom
codex/issue-612-indexeddb-store
Mar 14, 2026
Merged

Persist events in IndexedDB events store with sent flag#617
narumincho merged 10 commits intomainfrom
codex/issue-612-indexeddb-store

Conversation

@narumincho
Copy link
Copy Markdown
Owner

Summary

  • add boolean field on events so sent status is stored in the events object store instead of event_send_queue
  • update client/UI files (local events, queues, components, styles) to use the new structure and keep the interface accessible
  • adjust server/client wiring (lib, fetch, diff) to coordinate with the revised persistence layer

Testing

  • Not run (not requested)

@narumincho narumincho linked an issue Mar 14, 2026 that may be closed by this pull request
4 tasks
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 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".

Comment on lines +39 to +41
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())
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 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();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 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 👍 / 👎.

@narumincho narumincho merged commit f94bb72 into main Mar 14, 2026
1 check passed
@narumincho narumincho deleted the codex/issue-612-indexeddb-store branch March 14, 2026 10:28
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.

イベントを indexedDB に保存. オフラインでも動作するように

1 participant