Skip to content

Commit b182986

Browse files
committed
feat: Force _rev for queries with .select fields
When specifying fields in a query, e.g. `Q('io.cozy.todos').where({done: true}).select(['date'])`, the revision was missing if not explicitly given. This is now problematic because we rely on the revision existence to identify "virtual" documents, i.e. not persisted in CouchDB, that never have any revision. See #1486 for more insights.
1 parent 594fe63 commit b182986

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

packages/cozy-stack-client/src/DocumentCollection.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -532,8 +532,8 @@ The returned documents are paginated by the stack.
532532
return {
533533
selector: mergedSelector,
534534
use_index: indexName,
535-
// TODO: type and class should not be necessary, it's just a temp fix for a stack bug
536-
fields: fields ? [...fields, '_id', '_type', 'class'] : undefined,
535+
// _id is necessary for the store, and _rev is required for offline. See https://github.com/cozy/cozy-client/blob/95978d39546023920b0c01d689fed5dd41577a02/packages/cozy-client/src/CozyClient.js#L1153
536+
fields: fields ? [...fields, '_id', '_rev'] : undefined,
537537
limit,
538538
skip,
539539
bookmark: options.bookmark || bookmark,

0 commit comments

Comments
 (0)