@pylonsync/sync 0.22.58 → 0.22.60

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.ts +4 -2
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.22.58",
6
+ "version": "0.22.60",
7
7
  "type": "module",
8
8
  "main": "./src/index.ts",
9
9
  "types": "./dist/index.d.ts",
package/src/index.ts CHANGED
@@ -64,6 +64,10 @@ export {
64
64
  type RoomSubscriber,
65
65
  } from "./room-subscriptions";
66
66
  export { IndexedDBPersistence, persistChange } from "./persistence";
67
+ // Static, not `import()`: every browser start opens the replica before it
68
+ // can show cached rows, so a dynamic import put one more round trip (a
69
+ // separate chunk the page could not modulepreload) in front of first render.
70
+ import { IndexedDBPersistence, persistChange } from "./persistence";
67
71
  export type { ReplicaPersistence } from "./persistence";
68
72
  export {
69
73
  BEARER_REJECTED_HEADER,
@@ -1016,7 +1020,6 @@ export class SyncEngine {
1016
1020
  if (this.config.persistence) {
1017
1021
  this.persistence = this.config.persistence;
1018
1022
  } else {
1019
- const { IndexedDBPersistence } = await import("./persistence");
1020
1023
  this.persistence = new IndexedDBPersistence(this.config.appName);
1021
1024
  }
1022
1025
  await this.persistence.open();
@@ -1100,7 +1103,6 @@ export class SyncEngine {
1100
1103
  // "cursor ahead of replica" on crash AND on quota/abort.
1101
1104
  const persistence = this.persistence;
1102
1105
  this.store._persistFn = async (change: ChangeEvent) => {
1103
- const { persistChange } = await import("./persistence");
1104
1106
  if (!persistence) return true;
1105
1107
  return persistChange(persistence, change);
1106
1108
  };