Skip to content

Conversation

@skynetigor
Copy link
Contributor

…ays a new object every render

Closes #5126

📑 Description

✅ Checks

  • My pull request adheres to the code style of this project
  • My code requires changes to the documentation
  • I have updated the documentation as required
  • All the tests have passed

ℹ Additional Information

@vercel
Copy link

vercel bot commented Jul 2, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
keep ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 2, 2025 0:37am

@skynetigor skynetigor marked this pull request as ready for review July 2, 2025 12:30
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. Bug Something isn't working UI User interface related issues labels Jul 2, 2025
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Incomplete Dependency Array in useMemo

The useMemo for parsedLocalStorageValue has an incomplete dependency array. It uses initialValue (via initialValueRef.current) but only depends on localStorageValue. This causes stale values to be returned when initialValue changes and localStorageValue is null or empty, as getParsedJson falls back to initialValue and the memoized function does not re-run.

keep-ui/utils/hooks/useLocalStorage.ts#L37-L41

);
const initialValueRef = useRef(initialValue);
initialValueRef.current = initialValue;
const parsedLocalStorageValue = useMemo(() => getParsedJson(localStorageValue, initialValueRef.current), [localStorageValue]);

Fix in Cursor


Was this report helpful? Give feedback by reacting with 👍 or 👎

Copy link
Member

@shahargl shahargl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jul 2, 2025
@skynetigor skynetigor merged commit 9aa3b87 into main Jul 2, 2025
20 of 23 checks passed
@skynetigor skynetigor deleted the 5126-History-page-makes-keep-unresponsive branch July 2, 2025 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files. UI User interface related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[🐛 Bug]: History page makes keep unresponsive

2 participants