From 0ad510e0d5efeb6f6b1af2ecf42bb9da64c83ee5 Mon Sep 17 00:00:00 2001 From: dzek Date: Mon, 4 Mar 2024 14:26:41 +0100 Subject: [PATCH] + `useDepEffect` alias for `useEffect2` ! missing dependency: `@ezez/utils` --- CHANGELOG.md | 6 ++++++ package.json | 4 ++-- pnpm-lock.yaml | 8 ++++---- src/pages/_app.tsx | 2 +- src/useEffect2.ts | 3 +++ 5 files changed, 16 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b80459..baea2e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [UNRELEASED] (nothing yet) +## [2.1.0] - 2024-03-03 +### Added +- `useDepEffect` alias for `useEffect2` +### Fixed +- missing dependency: `@ezez/utils` + ## [2.0.0] - 2023-12-30 ### Breaking - `useEffect2` will trigger the callback whenever the dependency array size change, this is different from `useEffect`, diff --git a/package.json b/package.json index d977e75..97d47f4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ezez/hooks", - "version": "2.0.0", + "version": "2.1.0", "repository": "git@github.com:dzek69/ezez-hooks.git", "author": "Jacek Nowacki", "license": "MIT", @@ -33,6 +33,7 @@ "types": "./esm/index.d.ts", "module": "./esm/index.js", "dependencies": { + "@ezez/utils": "^1.9.0", "oop-timers": "^5.0.0" }, "devDependencies": { @@ -44,7 +45,6 @@ "@dzek69/eslint-config-import-typescript": "^1.0.1", "@dzek69/eslint-config-react": "^1.2.2", "@dzek69/eslint-config-typescript": "^1.1.1", - "@ezez/utils": "^1.9.0", "@knodes/typedoc-plugin-pages": "^0.23.4", "@types/jest": "^29.5.2", "@types/react": "^18.2.8", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7c653a7..db54a0e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -5,6 +5,9 @@ settings: excludeLinksFromLockfile: false dependencies: + '@ezez/utils': + specifier: ^1.9.0 + version: 1.9.0 oop-timers: specifier: ^5.0.0 version: 5.0.0 @@ -34,9 +37,6 @@ devDependencies: '@dzek69/eslint-config-typescript': specifier: ^1.1.1 version: 1.1.1(@typescript-eslint/eslint-plugin@5.61.0)(@typescript-eslint/parser@5.61.0)(eslint@8.44.0)(typescript@5.1.3) - '@ezez/utils': - specifier: ^1.9.0 - version: 1.9.0 '@knodes/typedoc-plugin-pages': specifier: ^0.23.4 version: 0.23.4(lunr@2.3.9)(typedoc@0.23.28) @@ -1561,7 +1561,7 @@ packages: /@ezez/utils@1.9.0: resolution: {integrity: sha512-pIuKqUxf+U13Xc49x9k9WbIpGSVqzgmvTrNHEMOKS1XUpwT2F/dDxUjadJmwRLprXRmkDfTtOBU03v9b0+WqAw==} - dev: true + dev: false /@humanwhocodes/config-array@0.11.10: resolution: {integrity: sha512-KVVjQmNUepDVGXNuoRRdmmEjruj0KfiGSbS8LVc12LMsWDQzRXJ0qdhN8L8uUigKpfEHRhlaQFY0ib1tnUbNeQ==} diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index 0d41c74..3e5035c 100644 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -9,7 +9,7 @@ import { InputDeviceProvider } from "../useInputDevice.js"; const MyApp = ({ Component, pageProps }: AppProps) => ( <> - @ezez/utils + @ezez/hooks diff --git a/src/useEffect2.ts b/src/useEffect2.ts index d3f8f72..cee2220 100644 --- a/src/useEffect2.ts +++ b/src/useEffect2.ts @@ -19,6 +19,7 @@ const shallowCompareArrays = (a: T, b: T) => { // esli * @param dependencies - array of dependencies * * @example + * ```typescript * const { isAdmin, name } = useUserData(); // isAdmin is boolean, name is string * * useEffect2((prev) => { @@ -40,6 +41,7 @@ const shallowCompareArrays = (a: T, b: T) => { // esli * } * alert(message); * }, [isAdmin, name] as const); + * ``` */ const useEffect2 = )>( // eslint-disable-next-line @typescript-eslint/no-invalid-void-type @@ -59,4 +61,5 @@ const useEffect2 = )>( export { useEffect2, + useEffect2 as useDepEffect, };