)
...options,
};
- store.dispatch(
- persistBox.setState({
- options: finalOptions,
- loading: loading,
- }),
- );
+ override(store, 'init', (init) => {
+ return () => {
+ init();
+ store.dispatch(
+ persistBox.setState({
+ options: finalOptions,
+ loading: loading,
+ }),
+ );
+ };
+ });
- override(store, 'select', (original) => {
+ override(store, 'select', (select) => {
return (selectable: any): any => {
throw new NotImplemented();
};
diff --git a/packages/amos-react/src/useSelector.spec.tsx b/packages/amos-react/src/useSelector.spec.tsx
index 6a9d4b7..067a339 100644
--- a/packages/amos-react/src/useSelector.spec.tsx
+++ b/packages/amos-react/src/useSelector.spec.tsx
@@ -4,7 +4,7 @@
*/
import { act, renderHook, RenderHookResult } from '@testing-library/react-hooks';
-import { createStore, MapSelectable, Select, Selectable, selector, Snapshot, Store } from 'amos-core';
+import { createStore, MapSelectables, Select, Selectable, selector, Snapshot, Store } from 'amos-core';
import {
addTwiceAsync,
countBox,
@@ -35,7 +35,7 @@ function renderUseSelector(
fn: (props: P) => Rs,
preloaded?: Snapshot,
initialProps?: P,
-): RenderHookResult
> & Store {
+): RenderHookResult
> & Store {
const store = createStore({ preloadedState: preloaded });
const hook = renderHook((props: P) => useSelector(fn(props)), {
wrapper: (props: any) => {props.children},
diff --git a/packages/amos-react/src/useSelector.ts b/packages/amos-react/src/useSelector.ts
index 28cc044..bd1668f 100644
--- a/packages/amos-react/src/useSelector.ts
+++ b/packages/amos-react/src/useSelector.ts
@@ -9,8 +9,8 @@ import {
isSelectValueEqual,
Select,
Selectable,
- Selector,
SelectEntry,
+ Selector,
} from 'amos';
import { useCallback, useDebugValue, useLayoutEffect, useReducer, useRef } from 'react';
import { useStore } from './context';
diff --git a/packages/amos/src/index.ts b/packages/amos/src/index.ts
index 6e57448..ef1fad3 100644
--- a/packages/amos/src/index.ts
+++ b/packages/amos/src/index.ts
@@ -44,7 +44,7 @@ export {
Dispatchable,
DispatchableRecord,
EnhanceableStore,
- MapSelectable,
+ MapSelectables,
Mutation,
MutationFactory,
MutationOptions,
diff --git a/yarn.lock b/yarn.lock
index 49f3fdf..c9ca8ad 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -4516,36 +4516,6 @@ __metadata:
languageName: node
linkType: hard
-"Counter-ec41ce@workspace:examples/Counter":
- version: 0.0.0-use.local
- resolution: "Counter-ec41ce@workspace:examples/Counter"
- dependencies:
- "@types/react": "npm:^18.3.10"
- "@types/react-dom": "npm:^18.3.0"
- "@vitejs/plugin-react": "npm:^4.3.2"
- globals: "npm:^15.9.0"
- react: "npm:^18.3.1"
- react-dom: "npm:^18.3.1"
- typescript: "npm:^5.5.3"
- vite: "npm:^5.4.8"
- languageName: unknown
- linkType: soft
-
-"TodoMVC-1c0570@workspace:examples/TodoMVC":
- version: 0.0.0-use.local
- resolution: "TodoMVC-1c0570@workspace:examples/TodoMVC"
- dependencies:
- "@types/react": "npm:^18.3.10"
- "@types/react-dom": "npm:^18.3.0"
- "@vitejs/plugin-react": "npm:^4.3.2"
- globals: "npm:^15.9.0"
- react: "npm:^18.3.1"
- react-dom: "npm:^18.3.1"
- typescript: "npm:^5.5.3"
- vite: "npm:^5.4.8"
- languageName: unknown
- linkType: soft
-
"abbrev@npm:^2.0.0":
version: 2.0.0
resolution: "abbrev@npm:2.0.0"
@@ -4729,6 +4699,36 @@ __metadata:
languageName: unknown
linkType: soft
+"amos-examples-counter@workspace:examples/Counter":
+ version: 0.0.0-use.local
+ resolution: "amos-examples-counter@workspace:examples/Counter"
+ dependencies:
+ "@types/react": "npm:^18.3.10"
+ "@types/react-dom": "npm:^18.3.0"
+ "@vitejs/plugin-react": "npm:^4.3.2"
+ globals: "npm:^15.9.0"
+ react: "npm:^18.3.1"
+ react-dom: "npm:^18.3.1"
+ typescript: "npm:^5.5.3"
+ vite: "npm:^5.4.8"
+ languageName: unknown
+ linkType: soft
+
+"amos-examples-todomvc@workspace:examples/TodoMVC":
+ version: 0.0.0-use.local
+ resolution: "amos-examples-todomvc@workspace:examples/TodoMVC"
+ dependencies:
+ "@types/react": "npm:^18.3.10"
+ "@types/react-dom": "npm:^18.3.0"
+ "@vitejs/plugin-react": "npm:^4.3.2"
+ globals: "npm:^15.9.0"
+ react: "npm:^18.3.1"
+ react-dom: "npm:^18.3.1"
+ typescript: "npm:^5.5.3"
+ vite: "npm:^5.4.8"
+ languageName: unknown
+ linkType: soft
+
"amos-io@workspace:packages/amos-io":
version: 0.0.0-use.local
resolution: "amos-io@workspace:packages/amos-io"