Skip to content

Conversation

@bfollington
Copy link
Contributor

@bfollington bfollington commented Nov 5, 2025

Previously, ct-select used JavaScript's strict equality (===) to compare
values when determining which option should be selected. This worked fine
for primitives but failed for object values like Cells because it compared
by reference.

Now using areLinksSame() from @commontools/runner which properly compares
Cell objects and other link-based values by their identity rather than
reference.

Changes:

  • Import areLinksSame from @commontools/runner
  • Replace values.includes() with values.some(v => areLinksSame(v, item.value))
    for multiple select
  • Replace item.value === val with areLinksSame(item.value, val) for
    single select

Fixes regression where charm objects and other Cell-based values weren't
being properly selected in ct-select dropdowns.


Summary by cubic

Fix ct-select to compare values with areLinksSame from @commontools/runner, rather than strict equality. This restores correct selection for object values (Cells/charm objects) in both single and multiple selects.

Written for commit 2fa4f3b. Summary will update automatically on new commits.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file

claude and others added 2 commits November 6, 2025 06:59
Previously, ct-select used JavaScript's strict equality (===) to compare
values when determining which option should be selected. This worked fine
for primitives but failed for object values like Cells because it compared
by reference.

Now using areLinksSame() from @commontools/runner which properly compares
Cell objects and other link-based values by their identity rather than
reference.

Changes:
- Import areLinksSame from @commontools/runner
- Replace values.includes() with values.some(v => areLinksSame(v, item.value))
  for multiple select
- Replace item.value === val with areLinksSame(item.value, val) for
  single select

Fixes regression where charm objects and other Cell-based values weren't
being properly selected in ct-select dropdowns.
@bfollington bfollington force-pushed the claude/fix-ct-select-object-equality-011CUqN5aBEKsSneNcDwpMbv branch from e68bfaa to 2fa4f3b Compare November 5, 2025 20:59
@bfollington bfollington merged commit 7999b46 into main Nov 5, 2025
8 checks passed
@bfollington bfollington deleted the claude/fix-ct-select-object-equality-011CUqN5aBEKsSneNcDwpMbv branch November 5, 2025 21:12
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.

3 participants