Skip to content

Commit 6c4db3b

Browse files
committed
chore: avoid breaking change
1 parent 769b46f commit 6c4db3b

File tree

4 files changed

+30
-6
lines changed

4 files changed

+30
-6
lines changed

packages/common/src/client/AbstractPowerSyncDatabase.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ export interface DisconnectAndClearOptions {
3939
export interface BasePowerSyncDatabaseOptions extends AdditionalConnectionOptions {
4040
/** Schema used for the local database. */
4141
schema: Schema;
42+
/**
43+
* @deprecated Use {@link retryDelayMs} instead as this will be removed in future releases.
44+
*/
45+
retryDelay?: number;
4246
logger?: ILogger;
4347
}
4448

packages/react-native/src/db/PowerSyncDatabase.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {
22
AbstractPowerSyncDatabase,
33
AbstractStreamingSyncImplementation,
4+
AdditionalConnectionOptions,
45
BucketStorageAdapter,
56
DBAdapter,
67
PowerSyncBackendConnector,
@@ -44,14 +45,11 @@ export class PowerSyncDatabase extends AbstractPowerSyncDatabase {
4445
protected generateSyncStreamImplementation(
4546
connector: PowerSyncBackendConnector,
4647
// This is used to pass in options on connection instead of only during database creation
47-
options?: {
48-
retryDelayMs: number;
49-
crudUploadThrottleMs: number;
50-
}
48+
options?: AdditionalConnectionOptions
5149
): AbstractStreamingSyncImplementation {
5250
const remote = new ReactNativeRemote(connector);
5351
// Use the options passed in during connect, or fallback to the options set during database creation
54-
const retryDelayMs = options?.retryDelayMs ?? this.options.retryDelayMs;
52+
const retryDelayMs = options?.retryDelayMs ?? this.options.retryDelayMs ?? this.options.retryDelay;
5553
const crudUploadThrottleMs = options?.crudUploadThrottleMs ?? this.options.crudUploadThrottleMs;
5654

5755
return new ReactNativeStreamingSyncImplementation({

packages/web/src/db/PowerSyncDatabase.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ export class PowerSyncDatabase extends AbstractPowerSyncDatabase {
172172
): StreamingSyncImplementation {
173173
const remote = new WebRemote(connector);
174174
// Use the options passed in during connect, or fallback to the options set during database creation
175-
const retryDelayMs = options?.retryDelayMs ?? this.options.retryDelayMs;
175+
const retryDelayMs = options?.retryDelayMs ?? this.options.retryDelayMs ?? this.options.retryDelay;
176176
const crudUploadThrottleMs = options?.crudUploadThrottleMs ?? this.options.crudUploadThrottleMs;
177177

178178
const syncOptions: WebStreamingSyncImplementationOptions = {

packages/web/tests/src/db/PowersyncDatabase.test.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,4 +97,26 @@ describe('PowerSyncDatabase - generateSyncStreamImplementation', () => {
9797
})
9898
)
9999
})
100+
101+
// This test can be removed once retryDelay is removed and entirely replaced with retryDelayMs
102+
it('works when using deprecated retryDelay instead of retryDelayMs', () => {
103+
const db = new PowerSyncDatabase({
104+
schema: testSchema,
105+
database: {
106+
dbFilename: 'test.db'
107+
},
108+
flags: {
109+
ssrMode: false,
110+
enableMultiTabs: false,
111+
},
112+
retryDelay: 11100,
113+
})
114+
115+
db['generateSyncStreamImplementation'](mockConnector)
116+
expect(WebStreamingSyncImplementation).toHaveBeenCalledWith(
117+
expect.objectContaining({
118+
retryDelayMs: 11100,
119+
})
120+
)
121+
})
100122
})

0 commit comments

Comments
 (0)