fix(components): empty document displays empty object instead of blank card COMPASS-9814#8247
fix(components): empty document displays empty object instead of blank card COMPASS-9814#8247dudaschar wants to merge 3 commits into
Conversation
| className={emptyDocumentStyles} | ||
| data-testid="readonly-document-empty" | ||
| > | ||
| {'{}'} |
There was a problem hiding this comment.
I'd maybe go for something like (empty document), this feels more aligned with the document card being distinct from the json view (this is also similar to how we indicate an empty array in the Document card)
| {'{}'} | |
| <em>(empty document)</em> |
| } | ||
| return ( | ||
| <> | ||
| <DocumentList.Document |
There was a problem hiding this comment.
I think we might want this change in the DocumentList.Document component itself, not in the list, to make sure that all these Document components everywhere consistently show an empty placeholder even when used as a one-off. But maybe I'm missing some reason for it to be only in the list here 🤔
There was a problem hiding this comment.
No, you are right. I added initially in the readonly the aggregation uses, but changing in the higher level will make the change broader.
| [editable, extraGutterWidth] | ||
| ); | ||
|
|
||
| const emptyDocumentOffset = useMemo( |
There was a problem hiding this comment.
Matching the same spacing for the content in a regular document preview, so they look alike when both are present in the same page.

Description
When using $project in aggregation pipelines, if that's no final content to the document, the output looks broken:
The readonly document component now returns


{}if that's no content to be displayed, which make clear the document exist, but that's no content to preview.Checklist
Motivation and Context
Open Questions
Dependents
Types of changes