in src/components/Database/DataViewer/common/fetch.ts [88:114]
function realtimeToViewModel(
ref: firebase.database.Reference,
queryParams: QueryParams
) {
let query: firebase.database.Query;
return once(ref).pipe(
switchMap((snap) => {
// The "default" query contains limitToFirst(50), so we can not blindly
// apply the query to leaf nodes. leafNodeRef.limitToFirst(n) will yield
// null data.
if (snap.hasChildren()) {
query = applyQuery(ref, queryParams);
return toObservable(query);
}
return toObservable(ref);
}),
map(
(snap): ViewModel => ({
value: snap.hasChildren() ? undefined : snap.val(),
children: snap.hasChildren() ? Object.keys(snap.val()) : NO_CHILDREN,
isRealtime: true,
isLoading: false,
query,
})
)
);
}