@octanejs/dexie 0.1.56 → 0.1.57
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@octanejs/dexie",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.57",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"dexie": "4.4.4"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"octane": "^0.
|
|
43
|
+
"octane": "^0.12.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@tsrx/react": "^0.4.5",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"dexie-react-hooks": "4.4.0",
|
|
49
49
|
"esbuild": "^0.28.1",
|
|
50
50
|
"fake-indexeddb": "6.2.5",
|
|
51
|
-
"octane": "0.
|
|
51
|
+
"octane": "0.12.0",
|
|
52
52
|
"playwright": "^1.61.1",
|
|
53
53
|
"react": "19.2.7",
|
|
54
54
|
"react-dom": "19.2.7",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { use, useEffect, useReducer, useRef } from 'octane';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Subscribable } from 'dexie';
|
|
3
3
|
import { splitSlot, subSlot } from './internal';
|
|
4
4
|
|
|
5
5
|
type Observer<T> = {
|
|
@@ -12,7 +12,7 @@ type Subscription = { unsubscribe(): unknown } | (() => unknown);
|
|
|
12
12
|
|
|
13
13
|
type CacheEntry<T> = {
|
|
14
14
|
key: readonly unknown[];
|
|
15
|
-
source:
|
|
15
|
+
source: Subscribable<T>;
|
|
16
16
|
current?: T;
|
|
17
17
|
hasValue: boolean;
|
|
18
18
|
promise?: Promise<T>;
|
|
@@ -34,16 +34,13 @@ function stop(subscription: Subscription | undefined) {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
function getEntry<T>(
|
|
37
|
-
getObservable: (() =>
|
|
37
|
+
getObservable: (() => Subscribable<T>) | Subscribable<T>,
|
|
38
38
|
cacheKey: readonly unknown[],
|
|
39
39
|
): CacheEntry<T> {
|
|
40
40
|
const existing = cache.find((entry) => sameKey(entry.key, cacheKey)) as CacheEntry<T> | undefined;
|
|
41
41
|
if (existing) return existing;
|
|
42
42
|
|
|
43
|
-
const source:
|
|
44
|
-
typeof getObservable === 'function'
|
|
45
|
-
? getObservable()
|
|
46
|
-
: (getObservable as InteropableObservable<T>);
|
|
43
|
+
const source = typeof getObservable === 'function' ? getObservable() : getObservable;
|
|
47
44
|
const entry = {
|
|
48
45
|
key: [...cacheKey],
|
|
49
46
|
source,
|
|
@@ -119,16 +116,16 @@ function getEntry<T>(
|
|
|
119
116
|
}
|
|
120
117
|
|
|
121
118
|
export function useSuspendingObservable<T>(
|
|
122
|
-
getObservable: (() =>
|
|
119
|
+
getObservable: (() => Subscribable<T>) | Subscribable<T>,
|
|
123
120
|
cacheKey: readonly unknown[],
|
|
124
121
|
): T;
|
|
125
122
|
export function useSuspendingObservable<T>(
|
|
126
|
-
getObservable: (() =>
|
|
123
|
+
getObservable: (() => Subscribable<T>) | Subscribable<T>,
|
|
127
124
|
cacheKey: readonly unknown[],
|
|
128
125
|
slot: symbol | undefined,
|
|
129
126
|
): T;
|
|
130
127
|
export function useSuspendingObservable<T>(
|
|
131
|
-
getObservable: (() =>
|
|
128
|
+
getObservable: (() => Subscribable<T>) | Subscribable<T>,
|
|
132
129
|
...rest: [readonly unknown[], symbol?]
|
|
133
130
|
): T {
|
|
134
131
|
const [args, slot] = splitSlot(rest);
|