You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was using a movie API to retrieve data for a movie and add data that as a cookie. However after adding multiple movies, eventually I was unable to add more. At that time, there were no error messages in either the browser or the console. Only after checking the cookies in the developer tools did I realize that I was not able to add the cookies due to the cookie capacity limit. I think it would be better if something happened (such as a message in the console) to show that it was unable to add a cookie due to the length
Environment
visual studio code: 1.78.2
browser: microsoft Edge, version:114.0.1823.37
react: 18.2.0
node: 16.19.0
react-use-cookie:1.4.0
You can recreate this by running,
npx create-react-app,
And updating App.js as below. Press the button to add the cookie untilt he length is exceeded.
I'd expect some kind of message when the cookie limit is reached and no save is possible.
Actual Result
Encoded data is stored in the cookie. Since it is roughly 1.5 kB, adding data three times will exceed the cookie limit of 4 kB. If you do it a third time and look at the cookie, you will see that only two times' worth of data is stored.
The text was updated successfully, but these errors were encountered:
I think what is particularly problematic about this is that it fails to save the cookie, but it will still update the state of the page as though the cookie was saved.
I feel like either it should only show what it was actually able to save in the cookie, or there should at least be like... a console.error("Cookie storage length exceeded.") type of message. Or both.
Description
I was using a movie API to retrieve data for a movie and add data that as a cookie. However after adding multiple movies, eventually I was unable to add more. At that time, there were no error messages in either the browser or the console. Only after checking the cookies in the developer tools did I realize that I was not able to add the cookies due to the cookie capacity limit. I think it would be better if something happened (such as a message in the console) to show that it was unable to add a cookie due to the length
Environment
visual studio code: 1.78.2
browser: microsoft Edge, version:114.0.1823.37
react: 18.2.0
node: 16.19.0
react-use-cookie:1.4.0
You can recreate this by running,
And updating App.js as below. Press the button to add the cookie untilt he length is exceeded.
The following is an example of the data stored in the cookies,
Expected Result
I'd expect some kind of message when the cookie limit is reached and no save is possible.
Actual Result
Encoded data is stored in the cookie. Since it is roughly 1.5 kB, adding data three times will exceed the cookie limit of 4 kB. If you do it a third time and look at the cookie, you will see that only two times' worth of data is stored.
The text was updated successfully, but these errors were encountered: