Skip to content

Commit fccf11e

Browse files
authored
fix: Broadcast logger not being being passed to WebRemote (#602)
1 parent d58b4fc commit fccf11e

File tree

2 files changed

+30
-22
lines changed

2 files changed

+30
-22
lines changed

.changeset/honest-melons-laugh.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@powersync/web': patch
3+
---
4+
5+
Fixed issue where broadcast logger wasn't being passed to WebRemote, causing worker remote logs not to be broadcasted to the tab's logs.

packages/web/src/worker/sync/SharedSyncImplementation.ts

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -306,28 +306,31 @@ export class SharedSyncImplementation
306306
// Create a new StreamingSyncImplementation for each connect call. This is usually done is all SDKs.
307307
return new WebStreamingSyncImplementation({
308308
adapter: new SqliteBucketStorage(this.dbAdapter!, new Mutex(), this.logger),
309-
remote: new WebRemote({
310-
fetchCredentials: async () => {
311-
const lastPort = this.ports[this.ports.length - 1];
312-
return new Promise(async (resolve, reject) => {
313-
const abortController = new AbortController();
314-
this.fetchCredentialsController = {
315-
controller: abortController,
316-
activePort: lastPort
317-
};
318-
319-
abortController.signal.onabort = reject;
320-
try {
321-
this.logger.log('calling the last port client provider for credentials');
322-
resolve(await lastPort.clientProvider.fetchCredentials());
323-
} catch (ex) {
324-
reject(ex);
325-
} finally {
326-
this.fetchCredentialsController = undefined;
327-
}
328-
});
329-
}
330-
}),
309+
remote: new WebRemote(
310+
{
311+
fetchCredentials: async () => {
312+
const lastPort = this.ports[this.ports.length - 1];
313+
return new Promise(async (resolve, reject) => {
314+
const abortController = new AbortController();
315+
this.fetchCredentialsController = {
316+
controller: abortController,
317+
activePort: lastPort
318+
};
319+
320+
abortController.signal.onabort = reject;
321+
try {
322+
this.logger.log('calling the last port client provider for credentials');
323+
resolve(await lastPort.clientProvider.fetchCredentials());
324+
} catch (ex) {
325+
reject(ex);
326+
} finally {
327+
this.fetchCredentialsController = undefined;
328+
}
329+
});
330+
}
331+
},
332+
this.logger
333+
),
331334
uploadCrud: async () => {
332335
const lastPort = this.ports[this.ports.length - 1];
333336

0 commit comments

Comments
 (0)