Skip to content

Commit

Permalink
Safer local filter for broken log
Browse files Browse the repository at this point in the history
  • Loading branch information
ai committed Jan 18, 2024
1 parent 45e6f0f commit 11158df
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions create-filter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,16 +220,18 @@ export function createFilter(client, Template, filter = {}, opts = {}) {
}

let removeAndListen = (childId, actionId) => {
let child = Template(childId, client)
let clear = child.listen(() => {})
remove(childId)
track(client, actionId)
.catch(() => {
add(child)
})
.finally(() => {
clear()
})
if (Template.remote) {
let child = Template(childId, client)
let clear = child.listen(() => {})
track(client, actionId)
.catch(() => {
add(child)
})
.finally(() => {
clear()
})
}
}

if (Template.remote) {
Expand Down Expand Up @@ -296,7 +298,12 @@ export function createFilter(client, Template, filter = {}, opts = {}) {
} else if (checkSomeFields(action.fields)) {
let child = Template(action.id, client)
let clear = child.listen(() => {})
if (child.value.isLoading) await child.loading
try {
if (child.value.isLoading) await child.loading
/* c8 ignore next 3 */
} catch {
return
}
if (checkAllFields(child.value)) {
clear()
add(child)
Expand Down

0 comments on commit 11158df

Please sign in to comment.