Skip to content

Commit 79e812b

Browse files
committed
chore: allow client restoration without sdk key or base url
1 parent c5703c3 commit 79e812b

2 files changed

Lines changed: 3 additions & 15 deletions

File tree

packages/sdk/src/client.ts

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -292,19 +292,7 @@ export function restoreReplaneClient<T extends object = Record<string, unknown>>
292292

293293
if (connection) {
294294
storage = new ReplaneRemoteStorage();
295-
streamOptions = {
296-
sdkKey: connection.sdkKey,
297-
baseUrl: connection.baseUrl.replace(/\/+$/, ""),
298-
fetchFn: connection.fetchFn ?? globalThis.fetch.bind(globalThis),
299-
requestTimeoutMs: connection.requestTimeoutMs ?? 2000,
300-
initializationTimeoutMs: 5000, // Not used for restore
301-
inactivityTimeoutMs: connection.inactivityTimeoutMs ?? 30_000,
302-
logger,
303-
retryDelayMs: connection.retryDelayMs ?? 200,
304-
context,
305-
requiredConfigs: [],
306-
fallbacks: [],
307-
};
295+
streamOptions = toFinalOptions(connection);
308296
}
309297

310298
const { client, startStreaming } = createClientCore<T>({

packages/sdk/tests/index.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1383,8 +1383,8 @@ describe("createReplaneClient", () => {
13831383
it("should not throw error when SDK key is missing", async () => {
13841384
await expect(
13851385
createReplaneClient({
1386-
sdkKey: "",
1387-
baseUrl: "https://replane.my-host.com",
1386+
sdkKey: undefined as unknown as string,
1387+
baseUrl: undefined as unknown as string,
13881388
fetchFn: mockServer.fetchFn,
13891389
logger: silentLogger,
13901390
initializationTimeoutMs: 200,

0 commit comments

Comments
 (0)