Skip to content
This repository has been archived by the owner on Oct 30, 2023. It is now read-only.

Commit

Permalink
fix: avoid mutation of user client options
Browse files Browse the repository at this point in the history
  • Loading branch information
owenpearson committed Aug 7, 2023
1 parent 06cf0ca commit a3cb538
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/AblyProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,19 @@ const canUseSymbol =
*/
export class Realtime extends Ably.Realtime.Promise {
constructor(options: string | Types.ClientOptions) {
let opts: Types.ClientOptions;

if (typeof options === 'string') {
options = {
opts = {
key: options,
} as Types.ClientOptions;
} else {
opts = { ...options };
}

(options as any).agents = { 'react-hooks': version };
(opts as any).agents = { 'react-hooks': version };

super(options);
super(opts);
}
}

Expand Down

0 comments on commit a3cb538

Please sign in to comment.