fix: record filter matches nothing for single-value fields - #202
Merged
Conversation
…rdinality Record fields always persist to json_value because RecordFieldType is declared as a multiChoice schema, but the filter branched on allow_multiple and queried string_value for single-value fields. That column is never populated, so filtering a single-value record field returned no rows. Also renders option labels as HTML. formatOptionWithAvatar() returns avatar markup, which SelectFilter escaped by default, printing the raw div in the dropdown.
ManukMinasyan
added a commit
to relaticle/relaticle
that referenced
this pull request
Aug 18, 2026
Record custom fields always persist to json_value, but the table filter queried string_value when allow_multiple was false, so filtering a single-value record field returned nothing. The package release also renders filter option labels as HTML instead of printing raw markup. Upstream: relaticle/custom-fields#202
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Filtering a table by a single-value Record custom field returns no rows, even when matching records exist. Multi-value Record fields filter correctly.
Found while answering https://github.com/orgs/relaticle/discussions/469 (using Record fields to model people-to-people relationships).
Root cause
RecordFilterbranched onallow_multipleand queried a different column per cardinality:RecordFieldType::configure()isFieldSchema::multiChoice()regardless ofallow_multiple, so values always land injson_value. The single-value branch queried a column that is always NULL for record fields:Also fixed
Filter option labels rendered as escaped HTML (
<div class="flex items-center gap-2"><img src="data:image/svg+xml;base64…).formatOptionWithAvatar()returns avatar markup but theSelectFilterdid not allow HTML.SelectFilterhas noallowHtml(), so this goes throughmodifyFormFieldUsing()onto the innerSelect. Both interpolations already pass throughe().Test
Added a dataset-driven case in
ListRecordsTestcovering both cardinalities. Verified load-bearing: with the source change reverted,single-valuefails andmulti-valuepasses.Verification
composer test:pest— 831 passed, 3 todosvendor/bin/phpstan analyse— no errorsvendor/bin/pint --test— passedRecordFilter.php— 100% (repo total is 99.4% before and after this change)