GraphQL error with M2A blocks in draft versions: Cannot return null for non-nullable field pages_blocks.id
メンテナーはふだん 2 日以内に返信
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 48/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- graphql, postgresql, typescript
調査の方向性
まず、提供された snapshot.json と文書化された M2A セットアップに対して、issue 内の draft-version query を再現します。draft のレスポンスと main item のレスポンスを比較し、null の junction row について GraphQL の結果を調査します。query が新しい変更を含むすべての draft block を、non-nullable-field error なしで返せば完了です。
索引モデルが issue の本文から書いたものです。
説明
Describe the Bug
I realize I'm not using the latest version of Directus in this bug report, but I have tested the bug locally in the latest version of Directus.
When querying a versioned (version: "draft") item that contains an M2A field, GraphQL fails with:
Cannot return null for non-nullable field pages_blocks.id
This happens because one of the M2A junction rows is returned as null in the draft version, even though the block exists and is valid in the Admin UI.
The same content works correctly when querying the main (non-versioned) item.
Additionally, in the Admin UI, the affected block shows issues with display templates, which may indicate the same underlying problem.
To Reproduce
Steps to Reproduce
- Create a block collection "faq_blocks".
- Create a page collection "pages".
- Enable versioning on the page collection.
- Add an M2A field "blocks" to page collection and configure to allow faq_blocks.
- Create an empty page.
- Create a draft version of the page.
- In the draft, add a new faq_blocks and save the draft version.
- Query the page via GraphQL:
query {
pages_by_id(id: "<page-id>", version: "draft") {
id
blocks {
id
collection
}
}
}
Expected Behavior
GraphQL should return all blocks, including draft changes, without errors.
Actual Behavior
{
"data": {
"pages_by_id": {
"id": "...",
"blocks": [
null
]
}
},
"errors": [
{
"message": "Cannot return null for non-nullable field pages_blocks.id.",
"path": ["pages_by_id", "blocks", 0, "id"]
}
]
}
It appears that draft versions can contain M2A relational rows where the junction id is null, but the GraphQL schema defines pages_blocks.id as non-nullable (ID!), causing the resolver to fail.
Directus Version
v11.17.1
Hosting Strategy
Self-Hosted (Docker Image)
Database
postgis/postgis:13-master
- 主要言語
- TypeScript
- スター
- 38.8k
- フォーク
- 5k
- 平均マージ
- 4日 23時間
- マージ済み PR(30日)
- 72
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
directus/directus のほかの issue
-
Dragging the trigger arrow in flow.vue copies the full FlowRaw object into stagedFlow and bypasses hasEdits再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープンBug Flows Low Impact Low Reach Studio
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
directus/directus#28399 · コメント 2 件 ·
メンテナーはふだん 2 日以内に返信
-
upstream
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
directus/directus#27190 · コメント 3 件 ·
メンテナーはふだん 2 日以内に返信
-
Environment Sync: push/diff fails with RECORD_NOT_UNIQUE on directus_operations.resolve when a flow's operation chain is rewired対応中かも @psang39 が 1 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 52/100
directus/directus#28520 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
Content Versioning: Builder (M2A) drawer shows published values instead of the version's changes対応中かも @eldertek が 3 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
directus/directus#28502 · コメント 2 件 ·
メンテナーはふだん 2 日以内に返信
-
Concurrent session refresh creates duplicate sessions on MySQL/MariaDB対応中かも @alexey-yarmosh が 27 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 25/100
directus/directus#28492 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
directus/directus の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
vercel-labs/ui#1066 ·
メンテナーはふだん 1 日以内に返信
-
fix(factory-cockpit): display active agent/actor name instead of verbose step name in run card badgeオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
ranxianglei/billion-context#7597 ·
メンテナーはふだん 1 日以内に返信
-
documentation target:powerpoint
難易度 1/5 1時間未満 初心者へのやさしさ 76/100
tomast1337/PdfLapas#602 ·
メンテナーはふだん 1 日以内に返信
-
kubernetes-ingestor: fetchCRDMapping() runs even when crossplane.enabled is false, logging a 403 ERROR every run対応中かも @kc9ddi が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
TeraSky-OSS/backstage-plugins#228 ·