Skip to content

Commit 580b2bf

Browse files
committed
Merge branch 'master' into feat/dialog-manager
# Conflicts: # docusaurus/sidebars-react.json
2 parents 7a67c03 + 9fa4806 commit 580b2bf

File tree

6 files changed

+52
-109
lines changed

6 files changed

+52
-109
lines changed

docusaurus/docs/React/components/contexts/thread-context.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ title: ThreadContext
77

88
## ThreadProvider
99

10-
Is a provider which wraps [`Channel`](../core-components/channel.mdx) component and takes [`Thread` instance]() as a value. The [`Channel`](../core-components/channel.mdx) wrapper acts as a temporary measure to make [`Thread` component](../core-components/thread.mdx) compatible with the new architecture which relies on [`Thread` instance](). The reliance on channel is temporary and will become deprecated in the future.
10+
Is a provider which wraps [`Channel`](../core-components/channel.mdx) component and takes [`Thread` instance](https://github.com/GetStream/stream-chat-js/blob/master/src/thread.ts) as a value. The [`Channel`](../core-components/channel.mdx) wrapper acts as a temporary measure to make [`Thread` component](../core-components/thread.mdx) compatible with the new architecture which relies on [`Thread` instance](https://github.com/GetStream/stream-chat-js/blob/master/src/thread.ts). The reliance on channel is _temporary_ and will become deprecated in the future.
1111

12-
Thread component newly prioritizes [`Thread` instance]() if rendered under [`ThreadProvider`](../contexts/thread-context.mdx#threadprovider) otherwise falls back to accessing thread from [`Channel` state](../contexts/channel-state-context.mdx).
12+
Thread component newly prioritizes [`Thread` instance](https://github.com/GetStream/stream-chat-js/blob/master/src/thread.ts) if rendered under `ThreadProvider` otherwise falls back to accessing thread from [`Channel` state](../contexts/channel-state-context.mdx).
1313

1414
### Basic Usage
1515

docusaurus/docs/React/components/core-components/thread-list.mdx

+29-4
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,42 @@ id: thread-list
33
title: ThreadList
44
---
55

6-
`ThreadList` is a component which renders individual thread instances ([`Thread`](https://github.com/GetStream/stream-chat-js/blob/master/src/thread.ts)) stored within `ThreadManager`. It handles pagination triggers and virtualization through the help of the [Virtuoso](https://virtuoso.dev) virtualized list component. The rest of the business logic lives within ThreadManager and Thread classes. ThreadManager instance gets activated whenever ThreadList renders - activation is necessary as it tells the SDK that user "sees" this list and can update state accordingly whenever appropriate events arrive.
7-
8-
If used in default form and rendered within `ThreadView` component it also allows to set active thread and handles `Thread` activation (similar to `ThreadManager` activation).
6+
`ThreadList` is a component that displays a list of threads where the current user is a participant (this user either started a thread, replied to a thread or was tagged in a thread). It handles pagination and virtualization through the help of the [virtualized list component](https://virtuoso.dev). The rest of the business logic (data manipulation) lives within [`ThreadManager`](https://github.com/GetStream/stream-chat-js/blob/master/src/thread.ts) and [`Thread`](https://github.com/GetStream/stream-chat-js/blob/master/src/thread_manager.ts) classes. Data represented through `ThreadList` are accessible from client instance (`client.threads.state`).
97

108
## Basic Usage
119

10+
The `ThreadList` component requires to be rendered within `Chat` component but apart from that does not require any other context to work.
11+
1212
```tsx
13+
import { Chat, ThreadList } from 'stream-chat-react';
14+
1315
<Chat client={client}>
1416
{/*...*/}
1517
<ThreadList />
16-
</Chat>
18+
</Chat>;
19+
```
20+
21+
For extended "out of the box" functionality `ThreadList` can be rendered within [`ChatView.Threads`](../utility-components/chat-view.mdx) component where individual items within the list become "selectable" through the `ThreadViewContext`. Selected/active thread can be then accessed from this context as well. See [`ChatView` documentation](../utility-components/chat-view.mdx) for extended functionality.
22+
23+
```tsx
24+
import { Chat, ChatView, ThreadList, useThreadsViewContext } from 'stream-chat-react';
25+
26+
const SelectedThread = () => {
27+
const { activeThread } = useThreadsViewContext();
28+
29+
return null;
30+
};
31+
32+
<Chat client={client}>
33+
<ChatView>
34+
<ChatView.Selector />
35+
{/*...*/}
36+
<ChatView.Threads>
37+
<ThreadList />
38+
<SelectedThread />
39+
</ChatView.Threads>
40+
</ChatView>
41+
</Chat>;
1742
```
1843

1944
## Props

docusaurus/docs/React/components/utility-components/view-components.mdx

-97
This file was deleted.

docusaurus/docs/React/guides/sdk-state-management.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ export const CustomChannelList = (props: ChannelListProps) => {
136136

137137
## Thread and ThreadManager
138138

139-
With the new [threads feature]() we've decided to refresh our state management and moved to a subscribable POJO with selector based system to make developer experience better when it came to rendering information provided by our `StreamChat` client.
139+
With the new [threads feature](../release-guides/upgrade-to-v12.mdx#introducing-threads-20) we've decided to refresh our state management and moved to a subscribable POJO with selector based system to make developer experience better when it came to rendering information provided by our `StreamChat` client.
140140

141141
:::note
142142
This change is currently only available within `StreamChat.threads` but will be reused across the whole SDK later on.
@@ -200,7 +200,7 @@ const Component3 = ({ userId }: { userId: string }) => {
200200

201201
### Accessing Reactive State
202202

203-
Our SDK currently allows to access two of these state structures - in [Thread]() and [ThreadManager]() instances under `state` property.
203+
Our SDK currently allows to access two of these state structures - in [`Thread`](https://github.com/GetStream/stream-chat-js/blob/master/src/thread.ts) and [`ThreadManager`](https://github.com/GetStream/stream-chat-js/blob/master/src/thread_manager.ts) instances under `state` property.
204204

205205
#### Vanilla
206206

docusaurus/docs/React/release-guides/upgrade-to-v12.mdx

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ With the release of v12 of our SDK we're also releasing new thread functionality
1010

1111
### Thread & ThreadManager
1212

13-
Both [`Thread`](https://github.com/GetStream/stream-chat-js/blob/master/src/thread.ts) and [`ThreadManager`](https://github.com/GetStream/stream-chat-js/blob/master/src/thread.ts) are new classes within [`stream-chat` package](https://www.npmjs.com/package/stream-chat) with own logic which updates their respective state objects to which integrators can subscribe to and render their UI accordingly. These classes (or rather instances of these classes) are utilised within React SDK. Read more about accessing state of these classes in our [SDK State Management documentation](../guides/sdk-state-management.mdx#thread-and-threadmanager).
13+
Both [`Thread`](https://github.com/GetStream/stream-chat-js/blob/master/src/thread.ts) and [`ThreadManager`](https://github.com/GetStream/stream-chat-js/blob/master/src/thread_manager.ts) are new classes within [`stream-chat` package](https://www.npmjs.com/package/stream-chat) with own logic which updates their respective state objects to which integrators can subscribe to and render their UI accordingly. These classes (or rather instances of these classes) are utilised within React SDK. Read more about accessing state of these classes in our [SDK State Management documentation](../guides/sdk-state-management.mdx#thread-and-threadmanager).
1414

1515
### ThreadList & ThreadListItem
1616

17-
[`ThreadList`](../components/core-components/thread-list.mdx) component represents a [`ThreadManager`](https://github.com/GetStream/stream-chat-js/blob/master/src/thread.ts) instance while [`ThreadListItem`](../components/core-components/thread-list-item.mdx) represents individual [`Thread`](https://github.com/GetStream/stream-chat-js/blob/master/src/thread.ts) instances. UI of both of these components reflects latest state of their appropriate "controllers" but apart from communicating with their controllers via available methods these components do not manage any extra logic.
17+
[`ThreadList`](../components/core-components/thread-list.mdx) component represents a [`ThreadManager`](https://github.com/GetStream/stream-chat-js/blob/master/src/thread_manager.ts) instance while [`ThreadListItem`](../components/core-components/thread-list-item.mdx) represents individual [`Thread`](https://github.com/GetStream/stream-chat-js/blob/master/src/thread.ts) instances. UI of both of these components reflects latest state of their appropriate "controllers" but apart from communicating with their controllers via available methods these components do not manage any extra logic.
1818

1919
### ThreadProvider
2020

docusaurus/sidebars-react.json

+17-2
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,19 @@
3333
"guides/multiple_channel_lists"
3434
]
3535
},
36+
{
37+
"Thread List": [
38+
"components/core-components/thread-list",
39+
"components/core-components/thread-list-item"
40+
]
41+
},
3642
{
3743
"Message List": [
3844
"components/core-components/message_list",
3945
"components/core-components/virtualized_list",
4046
"components/contexts/message_list_context",
41-
"components/core-components/thread"
47+
"components/core-components/thread",
48+
"components/contexts/thread-context"
4249
]
4350
},
4451
{
@@ -74,6 +81,7 @@
7481
"components/contexts/typing_context"
7582
]
7683
},
84+
"components/utility-components/chat-view",
7785
"components/utility-components/indicators",
7886
"components/utility-components/window",
7987
"components/contexts/translation_context"
@@ -141,10 +149,17 @@
141149
"guides/video-integration/video-integration-stream",
142150
"guides/sdk-state-management",
143151
"guides/date-time-formatting",
152+
"guides/custom-threads-view",
144153
"guides/dialog-management"
145154
]
146155
},
147-
{ "Release Guides": ["release-guides/upgrade-to-v12", "release-guides/upgrade-to-v11", "release-guides/upgrade-to-v10"] },
156+
{
157+
"Release Guides": [
158+
"release-guides/upgrade-to-v12",
159+
"release-guides/upgrade-to-v11",
160+
"release-guides/upgrade-to-v10"
161+
]
162+
},
148163
"troubleshooting/troubleshooting",
149164
"resources/resources"
150165
]

0 commit comments

Comments
 (0)