Skip to content

feat: [] Make Closest Preview preview field configurable - #10728

Open
Mitch Goudy (mgoudy91) wants to merge 2 commits into
masterfrom
codex/closest-preview-configurable-slug-field
Open

feat: [] Make Closest Preview preview field configurable#10728
Mitch Goudy (mgoudy91) wants to merge 2 commits into
masterfrom
codex/closest-preview-configurable-slug-field

Conversation

@mgoudy91

@mgoudy91 Mitch Goudy (mgoudy91) commented Mar 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a configurable installation parameter for the field id Closest Preview uses to identify previewable page entries, while keeping \ as the default so existing installs remain unchanged.

Staging link

image image image

Changes

  • Add a config-screen field for the preview field id and persist it in installation parameters
  • Use the configured field id when filtering eligible content types and when finding related root entries in the sidebar
  • Extend tests to cover both the default \ behavior and a custom field id like

Testing

  1. In the app config screen, set Preview field id to url for the customer-like scenario.
  2. Assign the relevant nested content types in the sidebar config.
  3. Open an entry that links up to a page entry using url instead of slug and confirm the sidebar now surfaces the parent previewable page.

@mgoudy91
Mitch Goudy (mgoudy91) requested a review from a team as a code owner March 20, 2026 19:04
Copilot AI review requested due to automatic review settings March 20, 2026 19:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for configuring which field ID “Closest Preview” uses to determine whether an entry is previewable (defaulting to slug for backwards compatibility).

Changes:

  • Add a “Preview field id” input to the Config Screen and persist it as an installation parameter.
  • Use the configured field id when filtering eligible content types and when identifying “root” entries in the Sidebar.
  • Extend mocks/tests to cover both default (slug) and custom (e.g. url) field ids.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
apps/closest-preview/src/locations/ConfigScreen.tsx Adds UI + persistence for configurable preview field id and passes it into content type filtering.
apps/closest-preview/src/components/ContentTypeMultiSelect.tsx Threads slugFieldId into content type filtering and updates effect deps/defaults.
apps/closest-preview/src/utils/livePreviewUtils.ts Makes slug-field checks configurable in content type filtering + root entry detection.
apps/closest-preview/src/types.ts Introduces installation parameter type and default slug field id constant.
apps/closest-preview/test/locations/ConfigScreen.spec.tsx Expands tests to cover loading/saving custom preview field id and filtering behavior.
apps/closest-preview/test/locations/Sidebar.spec.tsx Adds coverage for Sidebar behavior when preview field id is customized.
apps/closest-preview/test/mocks/mockSdk.ts Adds installation parameters to the SDK mock.
apps/closest-preview/test/mocks/mockCma.ts Adds url field + data to support custom field id tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread apps/closest-preview/test/locations/ConfigScreen.spec.tsx Outdated
Comment thread apps/closest-preview/src/locations/ConfigScreen.tsx Outdated
Comment thread apps/closest-preview/src/locations/ConfigScreen.tsx Outdated
Comment thread apps/closest-preview/src/types.ts Outdated
@mgoudy91
Mitch Goudy (mgoudy91) force-pushed the codex/closest-preview-configurable-slug-field branch from 325a060 to 0b04e62 Compare March 20, 2026 19:20
@mgoudy91 Mitch Goudy (mgoudy91) changed the title [] Make Closest Preview preview field configurable feat: [] Make Closest Preview preview field configurable Mar 20, 2026
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.

4 participants