Skip to content

Commit

Permalink
observing draft when hitting back button
Browse files Browse the repository at this point in the history
  • Loading branch information
Rajat-Dabade committed Dec 11, 2024
1 parent 8965394 commit 8c8e6f6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/components/draft/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ import Drafts from './draft';
import type {WithDatabaseArgs} from '@typings/database/database';
import type ChannelModel from '@typings/database/models/servers/channel';
import type ChannelMembershipModel from '@typings/database/models/servers/channel_membership';
import type DraftModel from '@typings/database/models/servers/draft';
import type UserModel from '@typings/database/models/servers/user';

type Props = {
channelId: string;
currentUser?: UserModel;
members?: ChannelMembershipModel[];
channel?: ChannelModel;
draft: DraftModel;
} & WithDatabaseArgs;

const withCurrentUser = withObservables([], ({database}: WithDatabaseArgs) => ({
Expand Down Expand Up @@ -72,9 +74,10 @@ const observeDraftReceiverUser = ({
return of(undefined);
};

const enhance = withObservables(['channel', 'members'], ({channel, database, currentUser, members}: Props) => {
const enhance = withObservables(['channel', 'members', 'draft'], ({channel, database, currentUser, members, draft}: Props) => {
const draftReceiverUser = observeDraftReceiverUser({members, database, channelData: channel, currentUser});
return {
draft: draft.observe(),
channel,
draftReceiverUser,
isPostPriorityEnabled: observeIsPostPriorityEnabled(database),
Expand Down

0 comments on commit 8c8e6f6

Please sign in to comment.