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

Query relationship in nested Tabs > Blocks > Tabs > Relationship is not working #10126

Open
LouisCuvelier opened this issue Dec 21, 2024 · 0 comments
Labels
status: needs-triage Possible bug which hasn't been reproduced yet

Comments

@LouisCuvelier
Copy link

Describe the Bug

I'm facing the same kind of issue as this one. But it's happening for something much more nested.

Here's the config of the collection :

{
      slug: 'test',
      fields: [
        {
          type: 'tabs',
          tabs: [
            {
              name: 'content',
              fields: [
                {
                  type: 'blocks',
                  name: 'blocks',
                  blocks: [
                    {
                      slug: 'testBlock',
                      fields: [
                        {
                          type: 'tabs',
                          tabs: [
                            {
                              name: 'meta',
                              fields: [
                                {
                                  type: 'relationship',
                                  relationTo: 'pages',
                                  name: 'relationToPage',
                                },
                              ],
                            },
                          ],
                        },
                      ],
                    },
                  ],
                },
              ],
            },
          ],
        },
      ],
    },

When I'm querying like this :

  const test = await payload.find({
    collection: 'test',
    limit: 1,
    pagination: false,
    depth: 500,
    where: {
      "content.blocks.meta.relationToPage": {
        equals: "67546c73b4175d00fae3466b"
      }
    },
  })

The returned value of test.docs is empty. But if, in the DB, I edit the relation value from an object id to a plain string, it's working.

Link to the code that reproduces this issue

https://github.com/Subrequest/payload-issue

Reproduction Steps

  1. Install the repo
  2. Seed the DB
  3. Create an entry for the collection called "Tests" and add one block with a relation.
  4. Get the ID of entry linked in the relation.
  5. Replace the value in src/app/(frontend)/[slug]/page.tsx line 76 with your ID.
  6. Load the home page of the front-end.
  7. Look at your logs. You should have an empty array.

Which area(s) are affected? (Select all that apply)

db-mongodb, area: core

Environment Info

Binaries:
  Node: 23.5.0
  npm: 10.9.2
  Yarn: N/A
  pnpm: 9.14.4
Relevant Packages:
  payload: 3.11.0
  next: 15.1.2
  @payloadcms/db-mongodb: 3.11.0
  @payloadcms/email-nodemailer: 3.11.0
  @payloadcms/graphql: 3.11.0
  @payloadcms/live-preview: 3.11.0
  @payloadcms/live-preview-react: 3.11.0
  @payloadcms/next/utilities: 3.11.0
  @payloadcms/payload-cloud: 3.11.0
  @payloadcms/plugin-form-builder: 3.11.0
  @payloadcms/plugin-nested-docs: 3.11.0
  @payloadcms/plugin-redirects: 3.11.0
  @payloadcms/plugin-search: 3.11.0
  @payloadcms/plugin-seo: 3.11.0
  @payloadcms/richtext-lexical: 3.11.0
  @payloadcms/translations: 3.11.0
  @payloadcms/ui/shared: 3.11.0
  react: 19.0.0-rc-66855b96-20241106
  react-dom: 19.0.0-rc-66855b96-20241106
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.2.0: Fri Dec  6 19:03:40 PST 2024; root:xnu-11215.61.5~2/RELEASE_ARM64_T6041
  Available memory (MB): 49152
  Available CPU cores: 12
@LouisCuvelier LouisCuvelier added status: needs-triage Possible bug which hasn't been reproduced yet validate-reproduction labels Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs-triage Possible bug which hasn't been reproduced yet
Projects
None yet
Development

No branches or pull requests

1 participant