Skip to content

Commit cbac62a

Browse files
fix: relaxes equality check for relationship options in filter (#7343)
Fixes #7271 When extracting the value from the querystring, it is _always_ a string. We were using a strict equality check which would cause the filter options to never find the correct option. This caused an infinite loop when using PG as ID's are numbers by default.
1 parent b5afc62 commit cbac62a

File tree

1 file changed

+4
-4
lines changed
  • packages/ui/src/elements/WhereBuilder/Condition/Relationship

1 file changed

+4
-4
lines changed

packages/ui/src/elements/WhereBuilder/Condition/Relationship/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ export const RelationshipField: React.FC<Props> = (props) => {
152152
options.forEach((opt) => {
153153
if (opt.options) {
154154
opt.options.some((subOpt) => {
155-
if (subOpt?.value === val.value) {
155+
if (subOpt?.value == val.value) {
156156
matchedOption = subOpt
157157
return true
158158
}
@@ -165,7 +165,7 @@ export const RelationshipField: React.FC<Props> = (props) => {
165165
return matchedOption
166166
}
167167

168-
return options.find((opt) => opt.value === val)
168+
return options.find((opt) => opt.value == val)
169169
})
170170
}
171171

@@ -180,7 +180,7 @@ export const RelationshipField: React.FC<Props> = (props) => {
180180
options.forEach((opt) => {
181181
if (opt?.options) {
182182
opt.options.some((subOpt) => {
183-
if (subOpt?.value === valueWithRelation.value) {
183+
if (subOpt?.value == valueWithRelation.value) {
184184
matchedOption = subOpt
185185
return true
186186
}
@@ -192,7 +192,7 @@ export const RelationshipField: React.FC<Props> = (props) => {
192192
return matchedOption
193193
}
194194

195-
return options.find((opt) => opt.value === value)
195+
return options.find((opt) => opt.value == value)
196196
}
197197

198198
return undefined

0 commit comments

Comments
 (0)