@@ -263,22 +263,20 @@ const Model = (() => {
263263
264264 /**
265265 * Concurrency strategy is to merge changes with
266- * last saved copy ; so {@link changes} should include
266+ * zthe current instance ; so {@link changes} should include
267267 * only the subset of properties that are changing.
268268 * Concomitant strategy is to use `Symbol`s to
269- * avoid conflict, which requires a custom
269+ * avoid conflict, which may require a custom
270270 * {@link Serializer} for network and storage
271- * transmission . If conflict does occur , last
271+ * handling . If conflict does occur, last
272272 * one in wins.
273273 *
274274 * @param {object } changes - object containing updated props
275275 * @param {boolean } validate - run validation by default
276276 * @returns {Promise<Model> }
277277 */
278278 async update ( changes , validate = true ) {
279- const lastsaved = datasource . findSync ( this [ ID ] ) || { }
280- const mergedata = { ...lastsaved , ...this }
281- const validated = validateUpdates ( mergedata , changes , validate )
279+ const validated = validateUpdates ( this , changes , validate )
282280 const timestamp = { ...validated , [ UPDATETIME ] : Date . now ( ) }
283281
284282 await datasource . save ( this [ ID ] , timestamp )
@@ -291,18 +289,7 @@ const Model = (() => {
291289 /**
292290 * Synchronous version of {@link Model.update}.
293291 * Only updates cache. External storage is
294- * not updated and no event is sent.
295- *
296- * Useful for:
297- * - immediate cache update
298- * - controlling when/if event is sent
299- * - calling external storage with custom adapter
300- *
301- * Consider situations in which the point is not
302- * to persist data, but to share it with other
303- * application components, as is done in workflow
304- * or between local related model threads, which
305- * use shared memory.
292+ * not updated
306293 *
307294 * @param {* } changes
308295 * @param {boolean } validate
0 commit comments