@octanejs/redux 0.1.32 → 0.1.34
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 +3 -3
- package/src/Provider.tsrx +10 -4
- package/src/hooks.ts +6 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@octanejs/redux",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.34",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"redux": "^5.0.0",
|
|
34
|
-
"octane": "0.1.
|
|
34
|
+
"octane": "0.1.37"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@reduxjs/toolkit": "^2.12.0",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"react-redux": "9.3.0",
|
|
43
43
|
"redux": "^5.0.1",
|
|
44
44
|
"vitest": "^4.1.10",
|
|
45
|
-
"octane": "0.1.
|
|
45
|
+
"octane": "0.1.37"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
|
48
48
|
"test": "vitest run"
|
package/src/Provider.tsrx
CHANGED
|
@@ -3,11 +3,17 @@
|
|
|
3
3
|
// subscription in a layout effect (subscribes to the store, re-notifies nested
|
|
4
4
|
// subs if the state moved between render and effect), and supports the
|
|
5
5
|
// `context` prop for library-owned stores (recharts-style custom contexts).
|
|
6
|
-
import { useMemo, useLayoutEffect } from 'octane';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
6
|
+
import { useMemo, useLayoutEffect, type OctaneNode } from 'octane';
|
|
7
|
+
import type { Action, Store, UnknownAction } from 'redux';
|
|
8
|
+
import { ReactReduxContext, type ReactReduxContextInstance } from './Context';
|
|
9
|
+
import { createSubscription } from './utils/Subscription';
|
|
9
10
|
|
|
10
|
-
export function Provider(props
|
|
11
|
+
export function Provider<A extends Action<string> = UnknownAction, S = unknown>(props: {
|
|
12
|
+
store: Store<S, A>;
|
|
13
|
+
children?: OctaneNode;
|
|
14
|
+
context?: ReactReduxContextInstance | null;
|
|
15
|
+
serverState?: S;
|
|
16
|
+
}) @{
|
|
11
17
|
const { store, context, serverState, children } = props;
|
|
12
18
|
|
|
13
19
|
const contextValue = useMemo(() => {
|
package/src/hooks.ts
CHANGED
|
@@ -12,6 +12,12 @@ import type { ReactReduxContextValue } from './Context';
|
|
|
12
12
|
import { useSyncExternalStoreWithSelector } from './utils/useSyncExternalStoreWithSelector';
|
|
13
13
|
import { splitSlot, subSlot } from './internal';
|
|
14
14
|
|
|
15
|
+
// The consumer's bundler substitutes the whole `process.env.NODE_ENV` expression
|
|
16
|
+
// below, so it must stay written out literally. Declared module-locally — never
|
|
17
|
+
// `declare global`, which would ship in the tarball — so this file type-checks in
|
|
18
|
+
// a browser app that has no `@types/node`.
|
|
19
|
+
declare const process: { env: { NODE_ENV?: string } };
|
|
20
|
+
|
|
15
21
|
const refEquality = (a: unknown, b: unknown) => a === b;
|
|
16
22
|
|
|
17
23
|
// useReduxContext — throws without a <Provider> (upstream parity). Context
|