Skip to content

Commit 3cac1a9

Browse files
committed
remove old types file and add watchers call
1 parent 54c0eff commit 3cac1a9

File tree

7 files changed

+38
-1650
lines changed

7 files changed

+38
-1650
lines changed

examples/messaging/src/App.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const userToken = process.env.REACT_APP_USER_TOKEN;
2222
const theme = 'light';
2323

2424
const filters = { type: 'messaging' };
25-
const options = { state: true, watch: true, presence: true, limit: 10 };
25+
const options = { state: true, presence: true, limit: 10 };
2626
const sort = {
2727
cid: 1,
2828
last_message_at: -1,

examples/typescript-app/src/App.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import React, { Component } from 'react';
2-
import { StreamChat } from 'stream-chat';
2+
import { ChannelSort, StreamChat } from 'stream-chat';
33
import {
44
Chat,
55
Channel,
6-
ChannelSort,
76
MessageList,
87
MessageInput,
98
MessageInputFlat,
@@ -15,6 +14,7 @@ import {
1514
ChannelList,
1615
Window,
1716
Thread,
17+
Theme,
1818
} from 'stream-chat-react';
1919
import 'stream-chat-react/dist/css/index.css';
2020
import './App.css';
@@ -50,7 +50,7 @@ class App extends Component {
5050

5151
render() {
5252
return (
53-
<Chat client={this.chatClient} theme={`messaging ${theme}`}>
53+
<Chat client={this.chatClient} theme={`messaging ${theme}` as Theme}>
5454
<ChannelList
5555
List={ChannelListMessenger}
5656
Preview={ChannelPreviewMessenger}

examples/typescript-app/yarn.lock

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3806,7 +3806,7 @@ data-urls@^1.0.0, data-urls@^1.1.0:
38063806
whatwg-mimetype "^2.2.0"
38073807
whatwg-url "^7.0.0"
38083808

3809-
dayjs@^1.10.3, dayjs@^1.10.4:
3809+
dayjs@^1.10.4:
38103810
version "1.10.4"
38113811
resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.10.4.tgz#8e544a9b8683f61783f570980a8a80eaf54ab1e2"
38123812
integrity sha512-RI/Hh4kqRc1UKLOAf/T5zdMMX5DQIlDxwUe3wSyMMnEbGunnpENCdbUgM+dW7kXidZqCttBrmw7BhN4TMddkCw==
@@ -4380,6 +4380,11 @@ escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5:
43804380
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
43814381
integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=
43824382

4383+
escape-string-regexp@^4.0.0:
4384+
version "4.0.0"
4385+
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34"
4386+
integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==
4387+
43834388
escodegen@^1.11.0, escodegen@^1.9.1:
43844389
version "1.14.3"
43854390
resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.14.3.tgz#4e7b81fba61581dc97582ed78cab7f0e8d63f503"
@@ -7350,6 +7355,15 @@ [email protected]:
73507355
dependencies:
73517356
unist-util-visit-parents "1.1.2"
73527357

7358+
7359+
version "1.1.1"
7360+
resolved "https://registry.yarnpkg.com/mdast-util-find-and-replace/-/mdast-util-find-and-replace-1.1.1.tgz#b7db1e873f96f66588c321f1363069abf607d1b5"
7361+
integrity sha512-9cKl33Y21lyckGzpSmEQnIDjEfeeWelN5s1kUW1LwdB0Fkuq2u+4GdqcGEygYxJE8GVqCl0741bYXHgamfWAZA==
7362+
dependencies:
7363+
escape-string-regexp "^4.0.0"
7364+
unist-util-is "^4.0.0"
7365+
unist-util-visit-parents "^3.0.0"
7366+
73537367
mdast-util-from-markdown@^0.8.0:
73547368
version "0.8.5"
73557369
resolved "https://registry.yarnpkg.com/mdast-util-from-markdown/-/mdast-util-from-markdown-0.8.5.tgz#d1ef2ca42bc377ecb0463a987910dae89bd9a28c"
@@ -9483,10 +9497,10 @@ react-file-icon@^0.2.0:
94839497
react-dom "^16.2.0"
94849498
tinycolor2 "^1.4.1"
94859499

9486-
react-file-utils@0.4.0:
9487-
version "0.4.0"
9488-
resolved "https://registry.yarnpkg.com/react-file-utils/-/react-file-utils-0.4.0.tgz#dc18537a94c227cf71648eae9a648f9f719b09a5"
9489-
integrity sha512-CvjThefxttg1MyxUi0pg2WNA3hHwuEvfrq+3FNRSfSVyijRRkgEjJNhOKR4OzcDHnUCxQjfskPaZWrhHsnkOaA==
9500+
react-file-utils@1.0.1:
9501+
version "1.0.1"
9502+
resolved "https://registry.yarnpkg.com/react-file-utils/-/react-file-utils-1.0.1.tgz#59645dc48d94417b87767327ff8627e3943bfbfc"
9503+
integrity sha512-gk0zvYAprvdQnFDy2zI3IDy8/q6vDPrJ8bFzsYQKonPccov549t5zt96827cLov4mwySvAMaHnlpCifTymu0Gg==
94909504
dependencies:
94919505
"@fortawesome/fontawesome-svg-core" "^1.2.13"
94929506
"@fortawesome/free-regular-svg-icons" "^5.7.0"

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "React components to create chat conversations or livestream style chat",
55
"author": "GetStream",
66
"homepage": "https://getstream.io/chat/",
7-
"typings": "./types/index.d.ts",
7+
"typings": "built/types/src/index.d.ts",
88
"main": "dist/index.js",
99
"module": "dist/index.es.js",
1010
"jsnext:main": "dist/index.es.js",

src/components/Chat/Chat.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,16 @@ import type {
1919
DefaultUserType,
2020
} from '../../../types/types';
2121

22-
export type Theme =
22+
export type Theme<T extends string = string> =
2323
| 'commerce dark'
2424
| 'commerce light'
2525
| 'livestream dark'
2626
| 'livestream light'
2727
| 'messaging dark'
2828
| 'messaging light'
2929
| 'team dark'
30-
| 'team light';
30+
| 'team light'
31+
| T;
3132

3233
export type ChatProps<
3334
At extends DefaultAttachmentType = DefaultAttachmentType,

src/components/ChatAutoComplete/ChatAutoComplete.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useCallback, useMemo } from 'react';
1+
import React, { useCallback, useEffect, useMemo } from 'react';
22
import debounce from 'lodash.debounce';
33

44
import { AutoCompleteTextarea } from '../AutoCompleteTextarea';
@@ -238,6 +238,16 @@ const UnMemoizedChatAutoComplete = <
238238
Us
239239
>();
240240

241+
useEffect(() => {
242+
const getWatchers = async () => {
243+
await channel?.watch({
244+
watchers: { limit: 20, offset: 0 },
245+
});
246+
};
247+
248+
getWatchers();
249+
}, [channel]);
250+
241251
const members = channel?.state?.members;
242252
const watchers = channel?.state?.watchers;
243253
const { emojiData, EmojiIndex } = emojiConfig || {};

0 commit comments

Comments
 (0)