Skip to content

Commit

Permalink
make condition more explicit
Browse files Browse the repository at this point in the history
  • Loading branch information
lukashass committed Jun 15, 2022
1 parent a175e69 commit 05e9876
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/useFind.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function loadServiceEventHandlers<
): () => void {
const onCreated = (createdItem: M): void => {
// ignore items not matching the query or when no params are set
if (!params.value || !sift(params.value.query || {})(createdItem)) {
if (!params.value || (params.value.query !== undefined && !sift(params.value.query)(createdItem))) {
return;
}

Expand All @@ -34,7 +34,7 @@ function loadServiceEventHandlers<

const onItemChanged = (changedItem: M): void => {
// ignore items not matching the query or when no params are set
if (!params.value || !sift(params.value.query || {})(changedItem)) {
if (!params.value || (params.value.query !== undefined && !sift(params.value.query)(changedItem))) {
// remove item from the list if they have been on it before
data.value = data.value.filter((item) => getId(item) !== getId(changedItem));
return;
Expand Down

0 comments on commit 05e9876

Please sign in to comment.