Elixir Mentor

Tony Dang on Offline-Enabled LiveView

17 snips
May 4, 2024
Tony Dang, a web developer, shares how he made LiveView apps offline-enabled using Svelte and Yjs, discussing state synchronization, offline modes, passkey auth, and potential projects with Oban. He highlights the evolution of projects and the benefits of using diagrams for learning Elixir frameworks.
Ask episode
AI Snips
Chapters
Transcript
Episode notes
INSIGHT

CRDTs Ensure Deterministic Merges

  • CRDTs like Yjs produce deterministic merges so clients converge without manual conflict resolution.
  • That makes them suitable for collaborative offline-first state syncing in Tony's to-do use case.
ADVICE

Prefer Incremental Updates Over Full State

  • Avoid running full Yjs merges on a separate cloud function unless necessary; the server can act as a dumb store and let clients merge.
  • For larger apps, send incremental updates and merge on the server to avoid transferring full state repeatedly.
ANECDOTE

Cloudflare Worker Failure Prompted Simplify

  • Tony first ran Yjs merges in a Cloudflare worker and saved merged state to the DB, but the worker went down unexpectedly.
  • That failure motivated him to simplify by having the server store Yjs blobs and let clients merge locally.
Get the Snipd Podcast app to discover more snips from this episode
Get the app