Skip to content
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
b32fbb4
Fix race condition of "not in chat"
PorterNan Mar 15, 2022
3a2cce2
Add comments about fetchInitialData
PorterNan Mar 15, 2022
5f572ba
Change files
PorterNan Mar 15, 2022
dc31fcc
Merge branch 'main' into jinan/fix-not-in-chat
PorterNan Mar 15, 2022
235010f
Update composite automation snapshots
github-actions[bot] Mar 15, 2022
3bbb7e3
Update composite automation snapshots
github-actions[bot] Mar 15, 2022
1f03d15
Update composite automation snapshots
github-actions[bot] Mar 15, 2022
623f333
Merge branch 'main' into jinan/fix-not-in-chat
PorterNan Mar 15, 2022
a1a5f03
Update composite automation snapshots
github-actions[bot] Mar 15, 2022
1bbbc8e
Merge branch 'main' into jinan/fix-not-in-chat
PorterNan Mar 15, 2022
bfa77e6
Update composite automation snapshots
github-actions[bot] Mar 15, 2022
dca6293
Update composite automation snapshots
github-actions[bot] Mar 15, 2022
4a3e088
Update composite automation snapshots
github-actions[bot] Mar 15, 2022
8da8033
Update composite automation snapshots
github-actions[bot] Mar 15, 2022
6fecd97
Update composite automation snapshots
github-actions[bot] Mar 15, 2022
80b2bc9
Add fetchInitData call before we render tests
PorterNan Mar 15, 2022
f00cbd1
Merge branch 'main' into jinan/fix-not-in-chat
PorterNan Mar 15, 2022
f71fd33
Add await to fetch data
PorterNan Mar 15, 2022
43714e7
Update composite automation snapshots
github-actions[bot] Mar 15, 2022
b390a98
Update composite automation snapshots
github-actions[bot] Mar 15, 2022
ec591de
Update composite automation snapshots
github-actions[bot] Mar 15, 2022
63cccf2
Update the comment
PorterNan Mar 15, 2022
ad4a85a
Revert screenshot change
PorterNan Mar 15, 2022
f9cd05f
Merge branch 'main' into jinan/fix-not-in-chat
PorterNan Mar 15, 2022
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Fix race condition of \"not in chat\"",
"packageName": "@internal/react-composites",
"email": "jiangnanhello@live.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ export const ChatScreen = (props: ChatScreenProps): JSX.Element => {
const adapter = useAdapter();

useEffect(() => {
// Initial data should be always fetched instead of adapter, controlled by composite
Comment thread
PorterNan marked this conversation as resolved.
Outdated
adapter.fetchInitialData();
Comment thread
PorterNan marked this conversation as resolved.
}, [adapter]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,6 @@ export const createAzureCommunicationChatAdapter = async ({
await chatClient.startRealtimeNotifications();

const adapter = await createAzureCommunicationChatAdapterFromClient(chatClient, chatThreadClient);
await adapter.fetchInitialData();
Comment thread
PorterNan marked this conversation as resolved.

return adapter;
};
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ function App(): JSX.Element {
}),
[]
);
const adapter = useAzureCommunicationChatAdapter(args);
const adapter = useAzureCommunicationChatAdapter(args, async (adapter) => {
// fetch initial data before we render the component to avoid flaky test (time gap between header and participant list)
await adapter.fetchInitialData();
return adapter;
});

React.useEffect(() => {
if (adapter && uploadedFiles.length) {
Expand Down