zustand-fetching
Advanced tools
Comparing version 2.0.6 to 2.0.7
@@ -32,2 +32,3 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime"; | ||
// you can write selector and merge params of request | ||
export const selector = leitenMap(["1", "2"], ([first, second]) => first.status === "loading" && second.status === "loading"); | ||
export const selector = leitenMap(["1", "2"], //you can receive keys from requestController, example useController.key; | ||
([first, second]) => first.status === "loading" && second.status === "loading"); |
@@ -50,5 +50,11 @@ import { produce } from "immer"; | ||
const useOpen = () => { | ||
return useLeitenModalManager((state) => [state.modals[key].open, state.modals[key].hidden], shallow); | ||
return useLeitenModalManager((state) => { | ||
var _a, _b, _c, _d; | ||
return [ | ||
(_b = (_a = state.modals[key]) === null || _a === void 0 ? void 0 : _a.open) !== null && _b !== void 0 ? _b : false, | ||
(_d = (_c = state.modals[key]) === null || _c === void 0 ? void 0 : _c.hidden) !== null && _d !== void 0 ? _d : false, | ||
]; | ||
}, shallow); | ||
}; | ||
return Object.assign(useOpen, { action, close, open }); | ||
}; |
{ | ||
"name": "zustand-fetching", | ||
"version": "2.0.6", | ||
"version": "2.0.7", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "description": "Zustand fetching helpers", |
@@ -19,7 +19,8 @@ # Zustand Fetching Helpers | ||
```tsx | ||
const useStore = create<IState>(() => ({ ... })); | ||
const useStore = create<IState>(() => ({ ... })); //clean store without actions | ||
const useController = leiten[Controller](useStore, "dot.nested.path", [options]); | ||
``` | ||
All actions and states out of your **zustand** store | ||
All actions and states out of your **zustand** | ||
store. [Live example](https://codesandbox.io/p/sandbox/bitter-lake-w57ywe?selection=%5B%7B%22endColumn%22%3A11%2C%22endLineNumber%22%3A11%2C%22startColumn%22%3A11%2C%22startLineNumber%22%3A11%7D%5D&file=%2Fsrc%2Frequest%2FRequest.tsx) | ||
@@ -61,3 +62,4 @@ - [leitenRequest](https://github.com/Hecmatyar/zustand-fetching/blob/main/src/examples/controllers/1_Controller_Request.tsx) | ||
**leitenRequest** and **leitenGrouprRequest** have reactions: _fulfilled_, _rejected_, _abort_, _resolved_ and _action_ | ||
**leitenRequest** and **leitenGrouprRequest** have a useful reactions: _fulfilled_, _rejected_, _abort_, _resolved_ | ||
and _action_ | ||
@@ -64,0 +66,0 @@ ### Request |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
88896
1809
123