Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: message list shouldn't get stuck loading #1009

Merged
merged 6 commits into from
Oct 30, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion data/feature-flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ export const featureFlags = [
'0x016b25', // adamalix.lens
'0x016b24', // bhavyam.lens
'0x016b0b', // xmtplabs.lens
'0xf5ff' // anoopr.lens
'0xf5ff', // anoopr.lens
'0x016b2e' // kenziestokes.lens
bigint marked this conversation as resolved.
Show resolved Hide resolved
]
},
{
Expand Down
6 changes: 4 additions & 2 deletions src/components/Messages/Composer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ import toast from 'react-hot-toast';

interface Props {
sendMessage: (message: string) => Promise<boolean>;
disabledInput: boolean;
}

const Composer: FC<Props> = ({ sendMessage }) => {
const Composer: FC<Props> = ({ sendMessage, disabledInput }) => {
const [message, setMessage] = useState<string>('');
const [sending, setSending] = useState<boolean>(false);

const canSendMessage = !sending && message.length > 0;
const canSendMessage = !disabledInput && !sending && message.length > 0;

const handleSend = async () => {
if (!canSendMessage) {
Expand Down Expand Up @@ -42,6 +43,7 @@ const Composer: FC<Props> = ({ sendMessage }) => {
type="text"
placeholder="Type Something"
value={message}
disabled={disabledInput}
onKeyDown={handleKeyDown}
onChange={(event) => setMessage(event.target.value)}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Messages/Message.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const Message: FC<MessageProps> = ({ conversationKey }) => {
hasMore={hasMore}
missingXmtpAuth={missingXmtpAuth ?? false}
/>
<Composer sendMessage={sendMessage} />
<Composer sendMessage={sendMessage} disabledInput={missingXmtpAuth ?? false} />
</>
)}
</Card>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Messages/MessagesList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const DateDivider: FC<{ date?: Date }> = ({ date }) => (
);

const MissingXmtpAuth: FC = () => (
<Card as="aside" className="mb-4 border-gray-400 !bg-gray-300 !bg-opacity-20 space-y-2.5 p-5">
<Card as="aside" className="mb-2 mr-4 border-gray-400 !bg-gray-300 !bg-opacity-20 space-y-2.5 p-5">
<div className="flex items-center space-x-2 font-bold">
<EmojiSadIcon className="w-5 h-5" />
<p>This fren hasn't enabled DMs yet</p>
Expand Down
2 changes: 1 addition & 1 deletion src/components/utils/hooks/useGetConversation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const useGetConversation = (conversationKey: string, profile?: Profile) => {
};
createNewConversation();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [profile]);
}, [profile, conversations]);
elisealix22 marked this conversation as resolved.
Show resolved Hide resolved

useEffect(() => {
if (!currentProfile) {
Expand Down