Skip to content

Commit

Permalink
working on nullable fields
Browse files Browse the repository at this point in the history
  • Loading branch information
davideast committed Jul 12, 2023
1 parent eddce81 commit e425254
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions database/list/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,11 @@ export function list(
const events = validateEventsArray(options.events);
return get(query).pipe(
switchMap((change) => {
let childEvent$: Observable<QueryChange | null>[];
if (!change.snapshot.exists()) {
return of([]);
childEvent$ = [of()];
}
const childEvent$ = [of(change)];
childEvent$ = [of(change)];
events.forEach((event) => {
childEvent$.push(fromRef(query, event));
});
Expand Down Expand Up @@ -106,7 +107,7 @@ function positionAfter(changes: QueryChange[], prevKey?: string): number {
}
}

function buildView(current: QueryChange[], change: QueryChange): QueryChange[] {
function buildView(current: QueryChange[] | null, change: QueryChange): QueryChange[] {
const {snapshot, prevKey, event} = change;
const {key} = snapshot;
const currentKeyPosition = positionFor(current, key);
Expand Down

0 comments on commit e425254

Please sign in to comment.