Skip to content

Conversation

@BiaDrab
Copy link

@BiaDrab BiaDrab commented Nov 6, 2025

Summary

This PR addresses the relation widget bugs reported in issue #7546 and discovers an additional related issue during investigation.

Issues Found and Fixed

Issue #7546 (Primary)

  1. Collapsed state showed placeholder - "No featured_entries" instead of selected entry title
  2. Search functionality broken - Queries returned "No options" even with matching entries
  3. New entries unselectable - Admin-created entries missing slug field required by relation widget

Additional Issue (Discovered)
4. Duplicate entry selection allowed - Same entry could be selected multiple times in the Top Posts list.

Root Causes

  • List summary referenced non-existent '{{title}}' field instead of actual relation field '{{fields.featured_entries}}'
  • Entries collection lacked slug field definition, causing newly created entries to be missing this required identifier
  • Relation widget couldn't match entries without slug value
  • No deduplication mechanism to prevent selecting the same entry twice

Solution:

Changed the list summary from '{{title}}' to '{{fields.featured_entries}}' to display the selected entry name
Added the slug field to the entries collection form so it's available in front matter
The relation widget now properly uses value_field: "slug" without extra braces

Testing

  • Create entry via admin UI with title and slug
  • Select entry in Top Posts dropdown - search works
  • Collapsed state displays entry title (not "No featured_entries")
  • Relation widget properly stores slug value
  • Multiple entries can be added without duplicates
  • Same entry cannot be selected twice in the same list

Configuration Changes

Homepage - Top Posts
summary: '{{fields.featured_entries}}' # Changed from '{{title}}'
# Entries collection - added slug field
- {label: "Slug", name: "slug", widget: "string", hint: "URL-friendly version (use hyphens, no spaces)"}

@BiaDrab BiaDrab requested a review from a team as a code owner November 6, 2025 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant