Skip to content

Commit b9ba8f9

Browse files
committed
Merge branch 'refs/heads/master' into feat/snooze-message-reminders
# Conflicts: # package.json # yarn.lock
2 parents 2482861 + d5f743b commit b9ba8f9

17 files changed

Lines changed: 102 additions & 48 deletions

File tree

CHANGELOG.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,29 @@
1+
## [13.0.5](https://github.com/GetStream/stream-chat-react/compare/v13.0.4...v13.0.5) (2025-05-28)
2+
3+
### Chores
4+
5+
* **deps:** upgrade @stream-io/stream-chat-css to v5.9.3 ([#2722](https://github.com/GetStream/stream-chat-react/issues/2722)) ([52abc83](https://github.com/GetStream/stream-chat-react/commit/52abc835b736963808b911db4c0bd1b1abb4cd7d))
6+
7+
## [13.0.4](https://github.com/GetStream/stream-chat-react/compare/v13.0.3...v13.0.4) (2025-05-22)
8+
9+
### Bug Fixes
10+
11+
* extend dialogManagerId's with dictinct strings ([#2696](https://github.com/GetStream/stream-chat-react/issues/2696)) ([137c2e7](https://github.com/GetStream/stream-chat-react/commit/137c2e723c0e8c9c77c49b01788136d012e7a82b)), closes [#2685](https://github.com/GetStream/stream-chat-react/issues/2685) [#2682](https://github.com/GetStream/stream-chat-react/issues/2682)
12+
13+
## [13.0.3](https://github.com/GetStream/stream-chat-react/compare/v13.0.2...v13.0.3) (2025-05-22)
14+
15+
### Chores
16+
17+
* **deps:** upgrade stream-chat-css to version 5.9.2 ([b53e03d](https://github.com/GetStream/stream-chat-react/commit/b53e03d94370850e612455290e4988834ec0c6ca))
18+
19+
## [13.0.2](https://github.com/GetStream/stream-chat-react/compare/v13.0.1...v13.0.2) (2025-05-21)
20+
21+
### Bug Fixes
22+
23+
* account for polls with no options in PollHeader text ([#2713](https://github.com/GetStream/stream-chat-react/issues/2713)) ([4c1cff7](https://github.com/GetStream/stream-chat-react/commit/4c1cff775ab2479dd8343e58ba84339aa62a414d))
24+
* export useAudioController hook ([#2717](https://github.com/GetStream/stream-chat-react/issues/2717)) ([8829e94](https://github.com/GetStream/stream-chat-react/commit/8829e94a3c9239f147784b9c63063facef65e10f))
25+
* prevent page reload on FormDialog submission with Enter key ([#2715](https://github.com/GetStream/stream-chat-react/issues/2715)) ([7c7f26e](https://github.com/GetStream/stream-chat-react/commit/7c7f26ec8d10500b36653c6ee83d97d3986c856b))
26+
127
## [13.0.1](https://github.com/GetStream/stream-chat-react/compare/v13.0.0...v13.0.1) (2025-05-15)
228

329
### Bug Fixes

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@
118118
"lodash.throttle": "^4.1.1",
119119
"lodash.uniqby": "^4.7.0",
120120
"nanoid": "^3.3.4",
121-
"prop-types": "^15.7.2",
122121
"react-dropzone": "^14.2.3",
123122
"react-fast-compare": "^3.2.2",
124123
"react-image-gallery": "1.2.12",
@@ -128,7 +127,6 @@
128127
"react-textarea-autosize": "^8.3.0",
129128
"react-virtuoso": "^2.16.5",
130129
"remark-gfm": "^4.0.1",
131-
"textarea-caret": "^3.1.0",
132130
"tslib": "^2.6.2",
133131
"unist-builder": "^4.0.0",
134132
"unist-util-visit": "^5.0.0",

src/components/Attachment/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ export * from './components';
88
export * from './UnsupportedAttachment';
99
export * from './FileAttachment';
1010
export * from './utils';
11+
export { useAudioController } from './hooks/useAudioController';

src/components/ChannelList/hooks/useChannelListShape.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -349,14 +349,14 @@ export const useChannelListShapeDefaults = () => {
349349
return customHandler(setChannels, event);
350350
}
351351

352-
if (!event.channel) {
352+
if (!event.channel_id && !event.channel_type) {
353353
return;
354354
}
355355

356356
const channel = await getChannel({
357357
client,
358-
id: event.channel.id,
359-
type: event.channel.type,
358+
id: event.channel_id,
359+
type: event.channel_type,
360360
});
361361

362362
const considerArchivedChannels = shouldConsiderArchivedChannels(filters);

src/components/Dialog/DialogManager.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { nanoid } from 'nanoid';
12
import { StateStore } from 'stream-chat';
23

34
export type GetOrCreateDialogParams = {
@@ -43,7 +44,7 @@ export class DialogManager {
4344
});
4445

4546
constructor({ id }: DialogManagerOptions = {}) {
46-
this.id = id ?? new Date().getTime().toString();
47+
this.id = id ?? nanoid();
4748
}
4849

4950
get openDialogCount() {

src/components/Dialog/DialogPortal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const DialogPortalDestination = () => {
1919
'--str-chat__dialog-overlay-height': openedDialogCount > 0 ? '100%' : '0',
2020
} as React.CSSProperties
2121
}
22-
></div>
22+
/>
2323
);
2424
};
2525

src/components/Dialog/FormDialog.tsx

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,13 @@ export const FormDialog = <
107107
<div className={clsx('str-chat__dialog str-chat__dialog--form', className)}>
108108
<div className='str-chat__dialog__body'>
109109
{title && <div className='str-chat__dialog__title'>{title}</div>}
110-
<form autoComplete='off'>
110+
<form
111+
autoComplete='off'
112+
onSubmit={(e) => {
113+
e.preventDefault();
114+
handleSubmit();
115+
}}
116+
>
111117
{Object.entries(fields).map(([id, fieldConfig]) => (
112118
<div className='str-chat__dialog__field' key={`dialog-field-${id}`}>
113119
{fieldConfig.label && (
@@ -129,26 +135,25 @@ export const FormDialog = <
129135
<FieldError text={fieldErrors[id]?.message} />
130136
</div>
131137
))}
138+
<div className='str-chat__dialog__controls'>
139+
<button
140+
className='str-chat__dialog__controls-button str-chat__dialog__controls-button--cancel'
141+
onClick={close}
142+
>
143+
{t<string>('Cancel')}
144+
</button>
145+
<button
146+
className='str-chat__dialog__controls-button str-chat__dialog__controls-button--submit'
147+
disabled={
148+
Object.keys(fieldErrors).length > 0 || shouldDisableSubmitButton?.(value)
149+
}
150+
type='submit'
151+
>
152+
{t<string>('Send')}
153+
</button>
154+
</div>
132155
</form>
133156
</div>
134-
<div className='str-chat__dialog__controls'>
135-
<button
136-
className='str-chat__dialog__controls-button str-chat__dialog__controls-button--cancel'
137-
onClick={close}
138-
>
139-
{t<string>('Cancel')}
140-
</button>
141-
<button
142-
className='str-chat__dialog__controls-button str-chat__dialog__controls-button--submit'
143-
disabled={
144-
Object.keys(fieldErrors).length > 0 || shouldDisableSubmitButton?.(value)
145-
}
146-
onClick={handleSubmit}
147-
type='submit'
148-
>
149-
{t<string>('Send')}
150-
</button>
151-
</div>
152157
</div>
153158
);
154159
};

src/components/Dialog/__tests__/DialogsManager.test.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { DialogManager } from '../DialogManager';
2+
import * as nanoid from 'nanoid';
23

34
const dialogId = 'dialogId';
45

@@ -10,11 +11,9 @@ describe('DialogManager', () => {
1011
});
1112

1213
it('initiates with default options', () => {
13-
const mockedId = '12345';
14-
const spy = jest.spyOn(Date.prototype, 'getTime').mockReturnValueOnce(mockedId);
14+
jest.spyOn(nanoid, 'nanoid').mockReturnValue('mockedId');
1515
const dialogManager = new DialogManager();
16-
expect(dialogManager.id).toBe(mockedId);
17-
spy.mockRestore();
16+
expect(dialogManager.id).toBe('mockedId');
1817
});
1918

2019
it('creates a new closed dialog', () => {

src/components/MessageInput/AttachmentSelector.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import { nanoid } from 'nanoid';
2-
import type { ElementRef } from 'react';
3-
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
1+
import React, { useCallback, useEffect, useRef, useState } from 'react';
42
import { UploadIcon as DefaultUploadIcon } from './icons';
53
import { useAttachmentManagerState } from './hooks/useAttachmentManagerState';
64
import { CHANNEL_CONTAINER_ID } from '../Channel/constants';
@@ -20,15 +18,16 @@ import {
2018
AttachmentSelectorContextProvider,
2119
useAttachmentSelectorContext,
2220
} from '../../context/AttachmentSelectorContext';
21+
import { useStableId } from '../UtilityComponents/useStableId';
2322

2423
export const SimpleAttachmentSelector = () => {
2524
const {
2625
AttachmentSelectorInitiationButtonContents,
2726
FileUploadIcon = DefaultUploadIcon,
2827
} = useComponentContext();
29-
const inputRef = useRef<ElementRef<'input'>>(null);
28+
const inputRef = useRef<HTMLInputElement | null>(null);
3029
const [labelElement, setLabelElement] = useState<HTMLLabelElement | null>(null);
31-
const id = useMemo(() => nanoid(), []);
30+
const id = useStableId();
3231

3332
useEffect(() => {
3433
if (!labelElement) return;
@@ -189,7 +188,7 @@ export const AttachmentSelector = ({
189188
const closeModal = useCallback(() => setModalContentActionAction(undefined), []);
190189

191190
const [fileInput, setFileInput] = useState<HTMLInputElement | null>(null);
192-
const menuButtonRef = useRef<ElementRef<'button'>>(null);
191+
const menuButtonRef = useRef<HTMLButtonElement>(null);
193192

194193
const getDefaultPortalDestination = useCallback(
195194
() => document.getElementById(CHANNEL_CONTAINER_ID),

src/components/MessageInput/MessageInput.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import type { ComponentContextValue } from '../../context/ComponentContext';
1010
import { useComponentContext } from '../../context/ComponentContext';
1111
import { MessageInputContextProvider } from '../../context/MessageInputContext';
1212
import { DialogManagerProvider } from '../../context';
13+
import { useStableId } from '../UtilityComponents/useStableId';
1314

1415
import type { LocalMessage, Message, SendMessageOptions } from 'stream-chat';
1516

@@ -134,10 +135,12 @@ const UnMemoizedMessageInput = (props: MessageInputProps) => {
134135

135136
const { Input: ContextInput } = useComponentContext('MessageInput');
136137

138+
const id = useStableId();
139+
137140
const Input = PropInput || ContextInput || MessageInputFlat;
138141
const dialogManagerId = props.isThreadInput
139-
? 'message-input-dialog-manager-thread'
140-
: 'message-input-dialog-manager';
142+
? `message-input-dialog-manager-thread-${id}`
143+
: `message-input-dialog-manager-${id}`;
141144

142145
return (
143146
<DialogManagerProvider id={dialogManagerId}>

0 commit comments

Comments
 (0)