Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[preview] Emit null as snapshot for missing documents #634

Merged
merged 2 commits into from
Mar 5, 2018

Conversation

bjoerge
Copy link
Member

@bjoerge bjoerge commented Mar 3, 2018

This improves how deleted/missing documents are passed through the preview pipeline, and fixes an error that would sometimes be triggered when a previewed document got deleted.

Previously, any preview observer that declared that they would display some fields on some document (e.g. fieldX, fieldY for document with _id abc) would always receive an object with the given fields no matter if the document existed or not. This made it impossible to tell the difference between a document that was deleted and a document that existed but had missing values for these fields.

(One consequence of this was that the reference select input for weak references was displaying "Untitled" after the reference got deleted.)

This fixes this problem by passing on null as the snapshot for deleted/missing documents.
I've also made sure to avoid calling preview.prepare if the preview snapshot is null (we may reconsider this, to support overriding the value for Untitled, but that requires some more thoughts I guess)

@bjoerge bjoerge requested a review from rexxars March 3, 2018 13:01
@bjoerge bjoerge force-pushed the preview-emit-null-for-missing-documents branch from dfe79b7 to 5e566fb Compare March 3, 2018 14:12
@bjoerge bjoerge force-pushed the preview-emit-null-for-missing-documents branch from 5e566fb to 90ba9c4 Compare March 5, 2018 08:21
@bjoerge bjoerge merged commit 6094cf3 into next Mar 5, 2018
@bjoerge bjoerge deleted the preview-emit-null-for-missing-documents branch March 5, 2018 12:18
bjoerge added a commit that referenced this pull request Mar 5, 2018
* [preview] Emit null values for missing/deleted documents

* [preview] Make sure changes are applied to snapshots of same revision
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants