Skip to content

v5.4.0

Compare
Choose a tag to compare
@cinnamon-bun cinnamon-bun released this 06 Oct 00:49

More detailed write events

8682832 WriteEvents have a new property, isLatest, which tells you if the written document is the latest one for that path. In other words, is it the "head", the one that will be returned from getDocument(path)? This is sometimes false when we obtain older synced documents which update an old item back in the history for a given path.

If your application ignores history documents and only uses the default latest document (e.g. as returned by getDocument), you probably want to ignore WriteEvents that have isLatest: false.

In settings where you're using history documents and doing your own conflict resolution (e.g. with documents({ includeHistory: true })), you will be interested in all of the WriteEvents.

Enforced immutability of document objects

92ea0bf Whenever an IStorage touches a document object, it calls Object.freeze(doc) on it. This happens when ingesting documents and also when returning them from getDocument() etc.

Document objects should always be treated as immutable; this just enforces that rule.