Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 1 addition & 2 deletions packages/client/src/Call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2436,9 +2436,8 @@ export class Call {
UpdateCallRequest
>(`${this.streamClientBasePath}`, updates);

const { call, members, own_capabilities } = response;
const { call, own_capabilities } = response;
this.state.updateFromCallResponse(call);
this.state.setMembers(members);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about this @jdimovska. This seems to be a backend bug; the SDK is implemented according to the OpenAPI contract.

this.state.setOwnCapabilities(own_capabilities);

return response;
Expand Down
17 changes: 17 additions & 0 deletions packages/client/src/__tests__/Call.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,23 @@ describe('state updates in reponse to coordinator API', () => {
expect(call.state.members[0].role).toBe('admin');
});

it('should not clear members when updating custom data', async () => {
await call.getOrCreate({
data: {
members: [{ user_id: 'sara' }, { user_id: 'jane' }],
},
});

expect(call.state.members.length).toBe(2);

await call.update({
custom: { messageId: 'test-message-id' },
});

expect(call.state.members.length).toBe(2);
expect(call.state.custom.messageId).toBe('test-message-id');
});

it('should get and update state', async () => {
await serverClient.video.call(call.type, call.id).create({
data: {
Expand Down
2 changes: 1 addition & 1 deletion sample-apps/react/react-dogfood/helpers/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export const createTokenProvider = (
const params = new URLSearchParams({
user_id: userId || '!anon',
environment,
exp: String(4 * 60 * 60), // 4 hours
exp: String(60), // 4 hours
} satisfies CreateJwtTokenRequest);

const res = await fetch(`${basePath}/api/auth/create-token?${params}`);
Expand Down
3 changes: 1 addition & 2 deletions sample-apps/react/react-dogfood/helpers/jwt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import { decodeBase64 } from 'stream-chat';
* The maximum validity of a token, in seconds.
* Defaults to 7 days.
*/
export const maxTokenValidityInSeconds: number =
Number(process.env.MAX_TOKEN_EXP_IN_SECONDS) || 7 * 24 * 60 * 60; // 7 days
export const maxTokenValidityInSeconds: number = 60;

export const createToken = async (
userId: string,
Expand Down
Loading