zustand-fetching
Advanced tools
Comparing version 2.0.1 to 2.0.2
{ | ||
"name": "zustand-fetching", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "description": "Zustand fetching helpers", |
@@ -8,6 +8,5 @@ # Zustand Fetching Helpers | ||
custom [slices](https://github.com/pmndrs/zustand/blob/main/docs/guides/slices-pattern.md) and dividing the store into | ||
several parts. Here are examples of our helpers | ||
for [slices](https://github.com/Hecmatyar/zustand-fetching/tree/main/src/examples/slices). However, in | ||
most cases, we need to divide the store into several parts because we add a lot of **unnecessary** data to the store and | ||
visually **overload** it. | ||
several parts. However, in most cases, we need to divide the store into several parts because we add a lot of | ||
unnecessary data, which can visually overload | ||
it. | ||
@@ -20,19 +19,19 @@ I propose several helpers that will take on a significant portion of the typical data work in your store. First, it is | ||
help you to handle request (any async function) and catch errors, return **hook** with params of request, and have | ||
methods: | ||
action, clear, abort, set | ||
methods _action_, _clear_, _abort_ and _set_. | ||
- [leitenGroupRequest](https://github.com/Hecmatyar/zustand-fetching/blob/main/src/examples/controllers/6_Controller_GroupRequest.tsx) | ||
handle a lot of similar requests dynamically, return **hook** with 2 overloads and have methods: call, clear | ||
handle a lot of similar requests dynamically, return **hook** with 2 overloads and have methods _call_ and _clear_. | ||
- [leitenRecord](https://github.com/Hecmatyar/zustand-fetching/blob/main/src/examples/controllers/2_Controller_Record.tsx) | ||
working with objects, have methods: set, patch, clear | ||
working with objects, have methods _set_, _patch_ and _clear_. | ||
- [leitenPrimitive](https://github.com/Hecmatyar/zustand-fetching/blob/main/src/examples/controllers/3_Controller_Primitive.tsx) | ||
working with data like with primitive value, but it can be object, function or primitives. Have methods set and clear | ||
working with data like with primitive value, but it can be object, function or primitives. Have methods _set_ and _ | ||
clear_. | ||
- [leitenList](https://github.com/Hecmatyar/zustand-fetching/blob/main/src/examples/controllers/4_Controller_List.tsx) | ||
working with array. Have methods set, clear, add, update, remove, toggle, filter. If array item is an object then | ||
set **compare** function in the controller's | ||
options (third parameter) | ||
working with array. Have methods _set_, _clear_, _add_, _update_, _remove_, _toggle_ and _filter_. If array item is an | ||
object then | ||
set **compare** function in the controller's options (third parameter). | ||
- [leitenNormalizedList](https://github.com/Hecmatyar/zustand-fetching/blob/main/src/examples/controllers/4_Controller_List.tsx) | ||
the same as leitenList but working with normalized state | ||
is the same as leitenList but working with normalized state. | ||
- [leitenModal](https://github.com/Hecmatyar/zustand-fetching/blob/main/src/examples/controllers/5_Controller_Modal.tsx) | ||
help to work with modals, have built in modal manager (if you want to open modal in cascade). Return hooks | ||
with [openState, hiddenState], have methods open, close and action | ||
with [openState, hiddenState], have methods _open_, _close_ and _action_. | ||
@@ -45,2 +44,4 @@ > All leitenControllers automatically calculate required type by path and **throw typescript error** if the specified | ||
Library well tree shaking and have dependencies from **immer**, **lodash-es** and **nanoid** | ||
## Advanced | ||
@@ -50,3 +51,3 @@ | ||
**leitenRecord**, **leitenPrimitive**, **leitenList** and **leitenNormalized** list have options with callbacks: | ||
**leitenRecord**, **leitenPrimitive**, **leitenList** and **leitenNormalizedList** have options with callbacks: | ||
_processingBeforeSet_, _sideEffect_, _patchEffect_. You can use them to extend basic functionality | ||
@@ -81,3 +82,3 @@ | ||
leitenGroupRequest return overloaded hook | ||
leitenGroupRequest return overloaded hook | ||
@@ -103,2 +104,12 @@ ```tsx | ||
const requests = useGroupController((state) => state); // Record with all requests | ||
``` | ||
``` | ||
### Store | ||
Wrappers for [ContextStore](https://github.com/Hecmatyar/zustand-fetching/blob/main/src/examples/store/ContextStore.tsx) | ||
and [ResettableStore](https://github.com/Hecmatyar/zustand-fetching/blob/main/src/examples/store/ResettableStore.tsx) | ||
### Slices | ||
Here are examples of our helpers | ||
for [slices](https://github.com/Hecmatyar/zustand-fetching/tree/main/src/examples/slices) |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
88059
109
0