Add observeWithColumns where needed (#6517)

This commit is contained in:
Daniel Espino García 2022-07-27 14:48:35 +02:00 committed by GitHub
parent 2249af4cde
commit b5dc0b02a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -25,7 +25,9 @@ const withCombinedPosts = withObservables(['postId'], ({database, postId}: WithD
);
const postIds = getPostIdsForCombinedUserActivityPost(postId);
const posts = queryPostsById(database, postIds).observe();
// Columns observed: `props` is used by `usernamesById`. `message` is used by generateCombinedPost.
const posts = queryPostsById(database, postIds).observeWithColumns(['props', 'message']);
const post = posts.pipe(map((ps) => generateCombinedPost(postId, ps)));
const canDelete = combineLatest([posts, currentUser]).pipe(
switchMap(([ps, u]) => (ps.length ? observePermissionForPost(database, ps[0], u, Permissions.DELETE_OTHERS_POSTS, false) : of$(false))),
@ -33,7 +35,7 @@ const withCombinedPosts = withObservables(['postId'], ({database, postId}: WithD
const usernamesById = post.pipe(
switchMap(
(p) => queryUsersByIdsOrUsernames(database, p.props.user_activity.allUserIds, p.props.user_activity.allUsernames).observe().
(p) => queryUsersByIdsOrUsernames(database, p.props.user_activity.allUserIds, p.props.user_activity.allUsernames).observeWithColumns(['username']).
pipe(
// eslint-disable-next-line max-nested-callbacks
switchMap((users) => {