@octanejs/livestore 0.0.31 → 0.0.32
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/livestore",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.32",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@opentelemetry/api": "1.9.0"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"octane": "^0.
|
|
52
|
+
"octane": "^0.11.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@livestore/adapter-web": "0.4.0",
|
|
@@ -60,10 +60,10 @@
|
|
|
60
60
|
"@types/react": "19.2.7",
|
|
61
61
|
"@types/react-dom": "19.2.3",
|
|
62
62
|
"@types/react-window": "1.8.8",
|
|
63
|
-
"@tsrx/react": "^0.
|
|
63
|
+
"@tsrx/react": "^0.4.5",
|
|
64
64
|
"esbuild": "^0.28.1",
|
|
65
65
|
"jsdom": "26.1.0",
|
|
66
|
-
"octane": "0.
|
|
66
|
+
"octane": "0.11.0",
|
|
67
67
|
"react": "19.2.3",
|
|
68
68
|
"react-dom": "19.2.3",
|
|
69
69
|
"react-window": "1.8.11",
|
|
@@ -12,8 +12,7 @@ export type StoreRegistryProviderProps = {
|
|
|
12
12
|
export const StoreRegistryProvider: ComponentBody<StoreRegistryProviderProps> = ({
|
|
13
13
|
storeRegistry,
|
|
14
14
|
children,
|
|
15
|
-
}) =>
|
|
16
|
-
<StoreRegistryContext value={storeRegistry}>{children}</StoreRegistryContext>;
|
|
15
|
+
}) => <StoreRegistryContext value={storeRegistry}>{children}</StoreRegistryContext>;
|
|
17
16
|
|
|
18
17
|
export const useStoreRegistry = (override?: StoreRegistry): StoreRegistry => {
|
|
19
18
|
if (override !== undefined && typeof override !== 'symbol') return override;
|
|
@@ -23,17 +23,19 @@ type ItemWrapperProps<TItem> = {
|
|
|
23
23
|
export function LiveList<TItem>({ items$, renderItem, getKey, store }: LiveListProps<TItem>) @{
|
|
24
24
|
const [hasMounted, setHasMounted] = useState(false);
|
|
25
25
|
useEffect(() => setHasMounted(true), []);
|
|
26
|
-
const keys = useQuery(
|
|
26
|
+
const keys = useQuery(
|
|
27
|
+
computed((get) => get(items$).map(getKey)),
|
|
28
|
+
{ store },
|
|
29
|
+
);
|
|
27
30
|
const entries = useMemo(
|
|
28
|
-
() =>
|
|
29
|
-
(key, index) => ({
|
|
31
|
+
() =>
|
|
32
|
+
keys.map((key, index) => ({
|
|
30
33
|
key,
|
|
31
34
|
index,
|
|
32
35
|
item$: computed((get) => get(items$).find((item) => getKey(item, 0) === key)!, {
|
|
33
36
|
deps: [key],
|
|
34
37
|
}) as LiveQueryDef<TItem>,
|
|
35
|
-
}),
|
|
36
|
-
),
|
|
38
|
+
})),
|
|
37
39
|
[getKey, items$, keys],
|
|
38
40
|
);
|
|
39
41
|
|
|
@@ -60,16 +62,15 @@ function ItemWrapper<TItem>({
|
|
|
60
62
|
}: ItemWrapperProps<TItem>) @{
|
|
61
63
|
const item = useQuery(item$, { store });
|
|
62
64
|
const options = useMemo(() => ({ index, isInitialListRender }), [index, isInitialListRender]);
|
|
63
|
-
<>
|
|
64
|
-
{renderItem(item, options)}
|
|
65
|
-
</>
|
|
65
|
+
<>{renderItem(item, options)}</>
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
const ItemWrapperMemo = memo(
|
|
69
69
|
ItemWrapper,
|
|
70
70
|
(previous, next) =>
|
|
71
|
-
previous.itemKey === next.itemKey &&
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
previous.itemKey === next.itemKey &&
|
|
72
|
+
previous.renderItem === next.renderItem &&
|
|
73
|
+
previous.store === next.store &&
|
|
74
|
+
previous.index === next.index &&
|
|
75
|
+
previous.isInitialListRender === next.isInitialListRender,
|
|
75
76
|
) as typeof ItemWrapper;
|