@electric-sql/client 1.5.8 → 1.5.9
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.
- package/dist/cjs/index.cjs +4 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/index.browser.mjs +4 -4
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.legacy-esm.js +4 -1
- package/dist/index.legacy-esm.js.map +1 -1
- package/dist/index.mjs +4 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +4 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@electric-sql/client",
|
|
3
3
|
"description": "Postgres everywhere - your data, in sync, wherever you need it.",
|
|
4
|
-
"version": "1.5.
|
|
4
|
+
"version": "1.5.9",
|
|
5
5
|
"author": "ElectricSQL team and contributors.",
|
|
6
6
|
"bugs": {
|
|
7
7
|
"url": "https://github.com/electric-sql/electric/issues"
|
package/src/client.ts
CHANGED
|
@@ -698,7 +698,6 @@ export class ShapeStream<T extends Row<unknown> = Row>
|
|
|
698
698
|
this.#fetchClient = createFetchWithConsumedMessages(this.#sseFetchClient)
|
|
699
699
|
|
|
700
700
|
this.#subscribeToVisibilityChanges()
|
|
701
|
-
this.#subscribeToWakeDetection()
|
|
702
701
|
}
|
|
703
702
|
|
|
704
703
|
get shapeHandle() {
|
|
@@ -723,6 +722,7 @@ export class ShapeStream<T extends Row<unknown> = Row>
|
|
|
723
722
|
|
|
724
723
|
async #start(): Promise<void> {
|
|
725
724
|
this.#started = true
|
|
725
|
+
this.#subscribeToWakeDetection()
|
|
726
726
|
|
|
727
727
|
try {
|
|
728
728
|
await this.#requestShape()
|
|
@@ -1643,6 +1643,7 @@ export class ShapeStream<T extends Row<unknown> = Row>
|
|
|
1643
1643
|
// Store cleanup function to remove the event listener
|
|
1644
1644
|
this.#unsubscribeFromVisibilityChanges = () => {
|
|
1645
1645
|
document.removeEventListener(`visibilitychange`, visibilityHandler)
|
|
1646
|
+
this.#unsubscribeFromVisibilityChanges = undefined
|
|
1646
1647
|
}
|
|
1647
1648
|
}
|
|
1648
1649
|
}
|
|
@@ -1661,6 +1662,7 @@ export class ShapeStream<T extends Row<unknown> = Row>
|
|
|
1661
1662
|
*/
|
|
1662
1663
|
#subscribeToWakeDetection() {
|
|
1663
1664
|
if (this.#hasBrowserVisibilityAPI()) return
|
|
1665
|
+
if (this.#unsubscribeFromWakeDetection) return
|
|
1664
1666
|
|
|
1665
1667
|
const INTERVAL_MS = 2_000
|
|
1666
1668
|
const WAKE_THRESHOLD_MS = 4_000
|
|
@@ -1695,6 +1697,7 @@ export class ShapeStream<T extends Row<unknown> = Row>
|
|
|
1695
1697
|
|
|
1696
1698
|
this.#unsubscribeFromWakeDetection = () => {
|
|
1697
1699
|
clearInterval(timer)
|
|
1700
|
+
this.#unsubscribeFromWakeDetection = undefined
|
|
1698
1701
|
}
|
|
1699
1702
|
}
|
|
1700
1703
|
|