Skip to content

Commit cbc02ac

Browse files
chore(release): version packages (#55)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent e3da9dc commit cbc02ac

3 files changed

Lines changed: 13 additions & 12 deletions

File tree

.changeset/fix-usecallback-csrftoken-dep.md

Lines changed: 0 additions & 11 deletions
This file was deleted.

packages/nextjs/CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# @csrf-armor/nextjs
22

3+
## 1.4.4
4+
5+
### Patch Changes
6+
7+
- [#54](https://github.com/muneebs/csrf-armor/pull/54) [`e3da9dc`](https://github.com/muneebs/csrf-armor/commit/e3da9dcd9b24dff45365bf1a61ff0017c9ce2f57) Thanks [@muneebs](https://github.com/muneebs)! - fix(react): remove unnecessary `csrfToken` dependency from `useCallback`
8+
9+
`secureFetch` previously listed `csrfToken` in its `useCallback` dependency array, causing the function reference to change every time the token updated. This made the `CsrfContextValue` unstable and triggered unnecessary re-renders in any component consuming `useCsrf()`.
10+
11+
The token equality check (`newToken !== csrfToken`) was also redundant because React's `setState` already bails out for identical primitive values. Removing both the dependency and the comparison fixes the re-render issue without changing behavior.
12+
13+
Fixes #53
14+
315
## 1.4.3
416

517
### Patch Changes

packages/nextjs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@csrf-armor/nextjs",
3-
"version": "1.4.3",
3+
"version": "1.4.4",
44
"description": "CSRF protection middleware for Next.js applications",
55
"type": "module",
66
"main": "./dist/index.js",

0 commit comments

Comments
 (0)