Skip to content

Fix ContentScopeControls groupBy fallback for scopes with different shapes - #6263

Draft
VPS-thodax wants to merge 1 commit into
mainfrom
claude/serene-galileo-uzexhr
Draft

Fix ContentScopeControls groupBy fallback for scopes with different shapes#6263
VPS-thodax wants to merge 1 commit into
mainfrom
claude/serene-galileo-uzexhr

Conversation

@VPS-thodax

Copy link
Copy Markdown
Contributor

Problem

ContentScopeControls derives its groupBy fallback from the currently selected scope's own keys (Object.keys(scope)[0]). When the available scopes have different shapes (e.g. { domain: "main" } and { company: "123" }), this can pick a dimension that not every scope has, breaking the scope switcher on scope change.

Cause

The fallback only looks at the single currently-active scope, not at the full set of available scopes (values), so it has no way to know whether the picked dimension is actually safe to group by across all of them.

Fix

The fallback now inspects all available scopes and only picks a groupBy dimension when every scope shares the exact same set of dimensions; otherwise no default is applied and the list stays ungrouped. ContentScopeSelect's hasMultipleDimensions check is also tightened to require every option to have more than one dimension before grouping is attempted, so a mix of shapes is never grouped by a dimension some option lacks.

Verification

Added unit tests in Controls.test.tsx covering both cases:

  • scopes with different shapes render without grouping or crashing
  • scopes with a uniform shape still group correctly by the shared dimension

Further information

…different shapes

The groupBy fallback derived a default dimension from the currently
selected scope's keys, but that shape isn't representative of all
available scopes. When scopes have different shapes (e.g. {domain}
vs {company}), this could apply a groupBy that other scopes don't
have, breaking the scope switcher. The fallback now only picks a
dimension when every scope shares the exact same shape. Also require
every option to have multiple dimensions before grouping is applied
in ContentScopeSelect, since mixed-shape options aren't safe to group
by a single dimension.
@coderabbitai

coderabbitai Bot commented Aug 30, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Comment @coderabbitai help to get the list of available commands.

@VPS-thodax VPS-thodax self-assigned this Aug 30, 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.

2 participants