Merge pull request #30507 from backstage/rugvip/in

catalog-react: fix $in being case sensitive
This commit is contained in:
Patrik Oldsberg
2025-07-14 10:44:40 +02:00
committed by GitHub
3 changed files with 9 additions and 6 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog-react': patch
---
Fixed a but in the new alpha entity predicates where the `$in` operator mistakenly case sensitive.
@@ -149,6 +149,8 @@ describe('entityPredicateToFilterFunction', () => {
['s,w,g,a', Object.create({ kind: 'component' })],
['', { 'metadata.tags': { $contains: 'go' } }],
['', { 'metadata.tags.0': 'java' }],
['s,w,g', { kind: { $in: ['component', 'group'] } }],
['a', { $not: { kind: { $in: ['component', 'group'] } } }],
['w,g,a', { $not: { 'metadata.tags': { $contains: 'java' } } }],
[
's,g',
@@ -15,11 +15,7 @@
*/
import { JsonValue } from '@backstage/types';
import {
EntityPredicate,
EntityPredicatePrimitive,
EntityPredicateValue,
} from './types';
import { EntityPredicate, EntityPredicateValue } from './types';
import { valueAtPath } from './valueAtPath';
/**
@@ -92,7 +88,7 @@ function evaluatePredicateValue(
return value.some(v => evaluateEntityPredicate(filter.$contains, v));
}
if ('$in' in filter) {
return filter.$in.includes(value as EntityPredicatePrimitive);
return filter.$in.some(search => valuesAreEqual(value, search));
}
if ('$exists' in filter) {
if (filter.$exists === true) {