Socket
Socket
Sign inDemoInstall

zustand-fetching

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zustand-fetching - npm Package Compare versions

Comparing version 2.2.0 to 2.3.0

dist/helpers/index.d.ts

2

dist/examples/controllers/1_Controller_Request.js
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
import { useEffect } from "react";
import { create } from "zustand";
import { leitenRequest } from "../../helpers/controllers";
import { leitenRequest } from "../../helpers";
import { getUser } from "../requests";

@@ -6,0 +6,0 @@ const useExampleStore = create(() => ({

import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
import { useEffect } from "react";
import { create } from "zustand";
import { leitenRecord, leitenRequest } from "../../helpers/controllers";
import { leitenRecord, leitenRequest } from "../../helpers";
import { getUser, updateUser } from "../requests";

@@ -6,0 +6,0 @@ const useExampleStore = create(() => ({

import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
import { useEffect } from "react";
import { create } from "zustand";
import { leitenPrimitive } from "../../helpers/controllers";
import { leitenPrimitive } from "../../helpers";
const useExampleStore = create(() => ({

@@ -6,0 +6,0 @@ step: 1,

import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
import { create } from "zustand";
import { leitenList, leitenNormalizedList } from "../../helpers/controllers";
import { leitenList, leitenNormalizedList } from "../../helpers";
const useExampleStore = create(() => ({

@@ -10,3 +10,5 @@ info: {

}));
const listController = leitenList(useExampleStore, "info.keywords");
const listController = leitenList(useExampleStore, "info.keywords", {
compare: (a, b) => a.value === b.value,
});
const normalizedListController = leitenNormalizedList(useExampleStore, "info.normalizedKeywords", { getKey: (item) => item.value });

@@ -13,0 +15,0 @@ const Keywords = () => {

@@ -1,4 +0,4 @@

export declare const useModalController: import("../../helpers/controllers").ILeitenModal<{
export declare const useModalController: import("../../helpers").ILeitenModal<{
name: string;
id: string;
}>;
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
import { useEffect } from "react";
import { create } from "zustand/esm";
import { leitenModal, leitenRequest } from "../../helpers/controllers";
import { leitenModal, leitenRequest } from "../../helpers";
import { getUser } from "../requests";

@@ -6,0 +6,0 @@ const useExampleStore = create(() => ({

import { ICard } from "../requests";
export declare const useGroupController: import("../../helpers/controllers").ILeitenGroupRequest<string, ICard>;
export declare const useGroupController: import("../../helpers").ILeitenGroupRequest<string, ICard>;
export declare const selector: (state: {
[key: string]: import("../..").ILeitenLoading<any, any>;
}) => boolean;
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
import { create } from "zustand";
import { leitenGroupRequest, leitenMap, useLeitenRequests, } from "../../helpers/controllers";
import { leitenGroupRequest, leitenMap, useLeitenRequests, } from "../../helpers";
import { getCard } from "../requests";

@@ -5,0 +5,0 @@ const useExampleStore = create(() => ({

@@ -10,3 +10,3 @@ /// <reference types="react" />

}>;
countController: import("../../helpers/controllers").ILeitenPrimitive<number>;
countController: import("../../helpers").ILeitenPrimitive<number>;
}) => T) => T;
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
// Define the store
import { createContextStore } from "../../helpers/contextStore";
import { leitenPrimitive } from "../../helpers/controllers";
import { leitenPrimitive } from "../../helpers";
import { createContextStore } from "../../store/contextStore";
export const [useCounterStore, CounterStoreProvider, useControllers] = createContextStore(() => ({

@@ -6,0 +6,0 @@ count: 0,

import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
import { createResettable } from "../../helpers/resettableStore";
import { createResettable } from "../../store/resettableStore";
const [useStore, ResetStoreProvider] = createResettable((set) => ({

@@ -4,0 +4,0 @@ products: [],

@@ -1,5 +0,4 @@

export * from "./helpers/contextStore";
export * from "./helpers/controllers";
export * from "./helpers/resettableStore";
export * from "./helpers/slices";
export * from "./helpers";
export * from "./interfaces/IContentLoading";
export * from "./store/contextStore";
export * from "./store/resettableStore";

@@ -1,5 +0,4 @@

export * from "./helpers/contextStore";
export * from "./helpers/controllers";
export * from "./helpers/resettableStore";
export * from "./helpers/slices";
export * from "./helpers";
export * from "./interfaces/IContentLoading";
export * from "./store/contextStore";
export * from "./store/resettableStore";
{
"name": "zustand-fetching",
"version": "2.2.0",
"version": "2.3.0",
"private": false,

@@ -79,3 +79,3 @@ "description": "Zustand fetching helpers",

"zustand": "^4.3.8",
"immer": "^10.0.1",
"immer": "^10.0.2",
"lodash-es": "^4.17.21"

@@ -82,0 +82,0 @@ },

@@ -12,8 +12,6 @@ # Zustand Fetching Helpers

I propose several helpers that will take on a significant portion of the typical data work in your store. First of all,
it is
easier to see
[Live example](https://codesandbox.io/p/sandbox/bitter-lake-w57ywe?selection=%5B%7B%22endColumn%22%3A44%2C%22endLineNumber%22%3A49%2C%22startColumn%22%3A44%2C%22startLineNumber%22%3A49%7D%5D&file=%2Fsrc%2Frequest%2FRequest.tsx)
on _codesandbox.io_ to understand what it is and how it works. In most cases, leiten controllers will help lighten the
store and
there will be no need to split it into several parts.
it is easier to see
[Live example on codesandbox](https://codesandbox.io/p/sandbox/bitter-lake-w57ywe?selection=%5B%7B%22endColumn%22%3A44%2C%22endLineNumber%22%3A49%2C%22startColumn%22%3A44%2C%22startLineNumber%22%3A49%7D%5D&file=%2Fsrc%2Frequest%2FRequest.tsx)
to understand what it is and how it works. In most cases, leiten controllers will help lighten the
store and there will be no need to split it into several parts.

@@ -68,2 +66,5 @@ Common view

- leitenList - if you are using object then you also should specify **compare** function like in example
- leitenNormalizedList - in addition to the **compare** function, you also need to define the **getKey** function
### Request

@@ -123,6 +124,1 @@

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)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc