findAndObserve: Be aware that findAndObserve may throw an error if the ‘id’ it is looking for does not exist in the database. Always ensure that you are using this method in a safe way.
withObservables:
2nd level query or “A query in a query” export const withSystemIds = withObservables([], ({database}) => ({ currentChannelId: database.collections.get(SYSTEM).findAndObserve(SYSTEM_IDENTIFIERS.CURRENT_CHANNEL_ID), currentUserId: database.collections.get(SYSTEM).findAndObserve(SYSTEM_IDENTIFIERS.CURRENT_USER_ID), config: database.collections.get(SYSTEM).findAndObserve(SYSTEM_IDENTIFIERS.CONFIG), }));
const withChannelAndTheme = withObservables(['currentChannelId'], ({currentChannelId, currentUserId, database}: WithChannelAndThemeArgs) => ({ channel: database.collections.get(CHANNEL).findAndObserve(currentChannelId.value), user: database.collections.get(USER).findAndObserve(currentUserId.value), }));
In the above block code, you will that the value contained in currentChannelId
is being used in