You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
The relation field lookup doesn't tolerate the Drafts #2997
Go to the "AS" collection and create 3 records, titled 1, 2, 3. Do not publish them, let the autosave work
Go to the Posts collection, open the existing post, and add try adding a ref to the AS collection
All 3 records will be suggested, but all 3 marked as "Untitled"
Describe the Bug
The issue here is that the relation lookup field is issuing the API request without specifying the "draft=true" param.
So, it only gets the "published" versions of the docs, which do not contain any data.
This, in turn, seems to be revealing another issue: when a document is created via the API, even in draft mode, its original props are saved to the "real" collection. But when it's created via the UI, the main collection will have an empty record (with only the internal fields, like cratedAt, _status, et.c), and the _versions collection will keep the real data of the draft object.
There is likely something we can improve here, but it isn't the issue as you described from my testing.
The problem isn't that the relationship is querying with/without drafts. When drafts without autosave, you won't have the issue, it is only when you enable autosave: true where the version data isn't returned the same way as without. That might fix the problem, but I want to understand this better first.
I don't know why it is, but you get different results if you query a collection that uses autosave with ?drafts=true vs without, though both can return documents with _status: 'draft'.
Yes, this is exactly what I have observed. And now, if you want things to
get funnier, you can try publishing and unpublished a doc. That would put
the latest draft data into the main table and keep it there.
On Mon, Jul 17, 2023, 22:38 Dan Ribbens ***@***.***> wrote:
There is likely something we can improve here, but it isn't the issue as
you described from my testing.
The problem isn't that the relationship is querying with/without drafts.
When drafts without autosave, you won't have the issue, it is only when
you enable autosave: true where the version data isn't returned the same
way as without. That might fix the problem, but I want to understand this
better first.
I don't know why it is, but you get different results if you query a
collection that uses autosave with ?drafts=true vs without, though both
can return documents with _status: 'draft'.
—
Reply to this email directly, view it on GitHub
<#2997 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAEAMCC5QBZJVIO6F7OEZITXQWIC5ANCNFSM6AAAAAA2JQWPUA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
@PatrikKozak let's work together on this one to fix it. I think @emirotin is correct in that we should just make sure ?draft=true is used when fetching relations.
Activity
DanRibbens commentedon Jul 17, 2023
There is likely something we can improve here, but it isn't the issue as you described from my testing.
The problem isn't that the relationship is querying with/without
drafts. When drafts withoutautosave, you won't have the issue, it is only when you enableautosave: truewhere the version data isn't returned the same way as without. That might fix the problem, but I want to understand this better first.I don't know why it is, but you get different results if you query a collection that uses autosave with
?drafts=truevs without, though both can return documents with_status: 'draft'.emirotin commentedon Jul 17, 2023
jmikrut commentedon Jan 8, 2024
@PatrikKozak let's work together on this one to fix it. I think @emirotin is correct in that we should just make sure
?draft=trueis used when fetching relations.github-actions commentedon Sep 7, 2024
This issue has been automatically locked.
Please open a new issue if this issue persists with any additional detail.