Skip to content

Commit

Permalink
Fix calling status on undefined (#183)
Browse files Browse the repository at this point in the history
* as can be seen from the if record conditional above record might be undefined. if so there is a crash. therefore

* log if the value is empty
  • Loading branch information
aaronmgdr authored Jul 19, 2024
1 parent c6c58b0 commit 48c05e0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions apps/web/utils/firebase-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,13 @@ export async function subscribeRequest(

if (record) {
onChange(record)
} else {
console.debug(snap.key, 'exists?', snap.exists())
}

if (
record.status === RequestStatus.Done ||
record.status === RequestStatus.Failed
record?.status === RequestStatus.Done ||
record?.status === RequestStatus.Failed
) {
ref.off('value', listener)
}
Expand Down

0 comments on commit 48c05e0

Please sign in to comment.