Repository navigation
fix(core): evaluate nested exists false filter when parent key is nullish (#5017) #5023
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,16 +5,10 @@ import type { EventFilter } from "./schemas/eventFilter.js"; | |
| // If the values of the array are objects, then we are doing content filtering | ||
| // An example would be [{ $endsWith: ".png" }, { $startsWith: "images/" } ] | ||
| export function eventFilterMatches(payload: any, filter: EventFilter): boolean { | ||
| if (payload === undefined || payload === null) { | ||
| if (Object.entries(filter).length === 0) { | ||
| return true; | ||
| } else { | ||
| return false; | ||
| } | ||
| } | ||
| const safePayload = payload ?? {}; | ||
|
|
||
| for (const [patternKey, patternValue] of Object.entries(filter)) { | ||
| const payloadValue = payload[patternKey]; | ||
| const payloadValue = safePayload[patternKey]; | ||
|
Comment on lines
+8
to
+11
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Missing nested keys appear to exist For a nullish parent, Learn moreThe matcher treats nullish payloads as an empty object so nested filters can evaluate missing children. Ordinary Example: With payload Recommended fix: Resolve Was this helpful? React with 👍 or 👎 to provide feedback. |
||
|
|
||
| if (Array.isArray(patternValue)) { | ||
| if (patternValue.length === 0) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔍 User-facing filter fix lacks a changeset
This changes published filter behavior, but the PR has no changeset. Repository guidance calls for one for user-facing package fixes.
Was this helpful? React with 👍 or 👎 to provide feedback.