keep opened chat open after refresh Send form by enter
This commit is contained in:
parent
d100f82666
commit
a0952c32c6
|
@ -58,7 +58,6 @@ export const InboxView = () => {
|
|||
try {
|
||||
const response = await loadMessages({ chat: chat.id })
|
||||
setMessages(response as unknown as MessageType[])
|
||||
// TODO: one client recreating
|
||||
} catch (error) {
|
||||
console.error('[loadMessages]', error)
|
||||
} finally {
|
||||
|
@ -143,6 +142,13 @@ export const InboxView = () => {
|
|||
return messages().find((message) => message.id === messageId)
|
||||
}
|
||||
|
||||
const handleKeyDown = (event) => {
|
||||
if (event.keyCode === 13 && !event.shiftKey && postMessageText().trim().length > 0) {
|
||||
event.preventDefault()
|
||||
handleSubmit()
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div class={clsx('container', styles.Inbox)}>
|
||||
<Modal variant="narrow" name="inviteToChat">
|
||||
|
@ -259,6 +265,7 @@ export const InboxView = () => {
|
|||
class={styles.textInput}
|
||||
value={postMessageText()}
|
||||
rows={1}
|
||||
onKeyDown={handleKeyDown}
|
||||
onInput={(event) => handleChangeMessage(event)}
|
||||
placeholder={t('Write message')}
|
||||
/>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { Accessor, createMemo, JSX, onMount } from 'solid-js'
|
||||
import { createContext, createSignal, useContext } from 'solid-js'
|
||||
import { createChatClient } from '../graphql/privateGraphQLClient'
|
||||
import type { Chat } from '../graphql/types.gen'
|
||||
import type { Chat, Message } from '../graphql/types.gen'
|
||||
import { apiClient } from '../utils/apiClient'
|
||||
import newMessage from '../graphql/subs/new-message'
|
||||
import type { Client } from '@urql/core'
|
||||
|
|
Loading…
Reference in New Issue
Block a user