0.2.0 changes some defaults and some stored or wire shapes of 0.1.0 (the main of 75e5f14, which was not
tagged). Deploy the Elixir and the JavaScript sides together, and read this list before you do. Items marked
(after 0.1.0) concern features added after 0.1.0 that changed again before 0.2.0: they matter only to code
that followed the untagged main. CHANGELOG.md also lists what was added.
Deploying. The server now sends entry operations (ops in live_slice:patch, from put_entries/5 and
the others) and binary columns of types :int16 and :uint16. A tab still running the previous bundle when the
new server is up does not apply ops (the patch is dropped without an error) and its column decoder throws
unknown column type 8 (or 9) for such a chunk, which the chunk loader reports as a failed chunk. The
server cannot fall back to whole keys, since it does not hold the client's value of a key. Keep the
phx-track-static attribute that Phoenix's root layout puts on the script and stylesheet tags: a tab whose
bundle is older than the server's reloads when it reconnects after the deploy, before any patch reaches it.
Only send the new operations or column types once the new bundle is deployed, if a tab may stay connected
across a deploy without phx-track-static.
Changed return values.
LiveSlice.CRDT.delete/2returns{:ok, generation}instead of:ok, asdelete/3already did (see Deleting a document). Migration: match{:ok, _generation}where code matched:ok({:ok, _generation} = LiveSlice.CRDT.delete(MyApp.CRDT, name), or that pattern in acase). The errors are unchanged.
Changed defaults.
- (after 0.1.0) Connection state: a store with no bridge mounted and none expected on the page is
"detached"instead of"connecting"(see Connection state): a page without the store's bridge, after the last bridge's element was removed, or after a live navigation to a page without one."connecting"now means a bridge is expected.store.connection, theconnectionKeysstatus key andonConnectionfollow. Nothing restores the old value; an interface that showed"connecting"for such pages reads"detached"as"connecting"(status === "detached" ? "connecting" : status). - Failed pushes: a server action that got no reply after
maxAttemptspushes is kept as failed (keepFailedis true by default) instead of rolled back with"push_failed": it stays applied and pending, and holds back the later calls that may concern its record, untilretry(id)ordiscard(id)(see Failed pushes). Without anonFailedlistener this is reported once withconsole.warn.keepFailed: falserestores the old behaviour exactly; a tab still running 0.1.0 (which always rolled such a call back) rejects a call another tab kept as failed when its queue reaches it. - Service worker: a precache file that is not a script, stylesheet or WebAssembly no longer fails the install;
it is skipped and reported (
essentialrestores the old rule). The manifest ofLiveSlice.ServiceWorkerleaves out digested names that:onlydoes not serve, and logs them;only: [](oronly_matching: []) now lists everything, asPlug.Staticserves everything with it. - Offline mount: a hook present in the page and not mounted offline is reported with
console.warn, once per name (never LiveView's ownPhoenix.hooks);excludesilences one. - Collaborative keys: local changes are batched (
batchMs, 50 ms); the status can be"waiting"; the status key hasunsent; mirrored keys are pushed before eachsync1. - Persisted keys are shared live between tabs (
persist.share, true;falseor a list of keys to share). - (after 0.1.0) The bridge sends queued calls again after settlements and retries, and
retry()sends at once after a push that timed out. - (after 0.1.0)
If-None-Matchgoes only to URLs of the page's origin;createLiveSliceHook({ conditional })opts other origins in. A 304 to a request without it is an error. LiveSlice.CRDT's:rate_limitis one window per key and LiveView, whatever document the key syncs (async1to another document no longer starts a fresh window), and background deliveries count in it, adeliver1included.- (after 0.1.0) Coalesced patches: those a
handle_action/4makes go out before its reply;invalidate/4sends the held patches of its store first; a patch made with a LiveComponent's socket is pushed at once. The first patch after a quiet time is no longer pushed alone in the middle of its callback: it goes out at the end of the callback with every patch of the store that callback makes (see Coalescing patches), so a callback that navigates callsflush_patches/2first for those too, and a held key keeps the key (atom or string) the patch gave instead of turning into a string.
Errors that used to pass.
- (after 0.1.0)
patch/4and the entry functions raiseArgumentErrorfor an unknown option. - (after 0.1.0) A connected LiveView that renders a bridge sending the actions of a
LiveSlice.Actionsmodule it does not attach raisesArgumentErrorat its first render. - (after 0.1.0)
send_json/3raises for a:versionthat is not a non-empty string, an integer, aDateTime,NaiveDateTimeorDate, and for data that is a function of another arity than zero.
Stored and wire shapes.
- The persisted record of a store has
seqandstamps(per key), now counted from the current time in milliseconds rather than from 1, andepochonce the record was cleared.removeStore(name, {clearPersisted: true})replaces the record by{cleared: id}instead of deleting it; a tab of the previous version reads that marker as an invalid record, removes it and writes its own state again, as it would after a delete. - Tabs also post
{type: "attempted", id, attempts}for each push of the sending tab; older tabs ignore it. - (after 0.1.0) Install reports in
live_slice:metacarryrank(the install order) andofflinePageis null when the offline page was not kept. A reset (unregisterServiceWorker({clearCaches: true})) deletes the reports. - (after 0.1.0)
send_json/3tags of versions with a comma, a quote, a space or non-ASCII characters are hashed (W/"h<hash>"); the tags of other versions are unchanged (W/"v<version>"). Weak comparison and*are honoured. - (after 0.1.0) The persistent chunk cache keys an entry with a per-chunk version by the version's type too: such entries cached before are fetched again once.
Additions: every listener event about a call (onPending, onQueued, onFailed, onRetry, onConflict,
onRejected, onSettled) and the context of an onConflict resolver carry at, the time the call was made, as
pending() does (see Offline promises and the time of a call), so a
test that compares whole events sees one more field. onReset of a collaborative key also gets carried,
carriedValue and notCarried (false, null and "off" unless carryOver is set). A document storage's load and setGeneration
resolve with carry too, setGeneration passes decide what is stored as a second argument, and its change
may hold carry and append (see crdt_storage.js); custom storages that do not know them keep working.
(after 0.1.0) The binding settles stored updates each time the server acknowledges changes, not only once
none is left, so after a reload unsent and unsentSince leave out what was acknowledged before (see Unsent
changes). Opt-in:
carryOver of a collaborative key and of deliverUnsentDocuments (see
Carrying unsent changes over), coalesce: [keep: keys],
createLiveSliceHook({ conditional }), persist.share as a list, dropUnsentDocument, onLoad and loaded of a
collaborative key, openTab() and storage of createFakeTabs() in live_slice/testing, and
LiveSlice.CRDT.delete(doc_name, opts) on the default server.
(after 0.1.0) LiveSlice.CRDT.MemoryPersistence.save/4 is there again for persistences that wrap it.