Skip to content

Entries Fieldtype: Empty field triggers queries across all collections instead of configured scope #11152

Open
@yurichudaev

Description

@yurichudaev

Bug description

When using fieldtype entries with an empty field value, the system queries ALL collections instead of limiting the scope to the configured collection.

Current behavior:

  1. With attached entry: Debugbar shows specific query for selected entry only
    image
  2. With empty field: Debugbar shows queries across ALL collections, potentially impacting performance
    image

Expected behavior:
Queries should be limited to the configured collection scope even when the field is empty.

Key Question:
Does this "empty field" scenario trigger a full reindexing process across all collections in the flat-file system? If so, what are the performance implications and recommended approaches to handle this?

Looking forward to your insights on this behavior.

Thanks, Yuri

How to reproduce

  1. Create a new site using statamic-cli
  2. Add fieldtype entries field to the 'pages' collection
  3. Configure the field to accept entries from 'posts' collection
  4. View the entry with empty field in Control Panel
  5. Check Debugbar queries

Logs

No response

Environment

- Statamic Version: 5.38.1
- PHP Version: 8.3.8
- Installation: Fresh statamic/statamic site via CLI
- Laragon

Installation

Fresh statamic/statamic site via CLI

Additional details

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions