primereact icon indicating copy to clipboard operation
primereact copied to clipboard

UseStorage hook window listener does not parse JSON

Open arnis87 opened this issue 3 years ago • 1 comments

When storing object in local storage using useStorate/useLocalStorage hook it parses/stringifies it fine when in current tab but when it is stored in another tab/window and gets refreshed it becomes string instead of object.

Traced it down to this line 26, I think it is missing JSON parse on the value: https://github.com/primefaces/primereact/blob/ad8dd1a7511f7e859cd926c1a300c1986ae44f03/components/lib/hooks/useStorage.js#L23-L29

arnis87 avatar Oct 04 '23 07:10 arnis87

thanks for the report please review my PR!

melloware avatar Oct 04 '23 11:10 melloware