-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
reactCookie.remove not functioning. #16
Comments
If you do a page refresh, is the cookie removed? |
The one detail that I notice is that the cookie will clear properly with non dynamic route
Any thought on what is causing this? For context, I've got a react app using relay in conjunction with a rails backend. |
This is probably a path problem with your cookie. Make sure to do: cookie.save('token', value, { path: '/' });
// ...
cookie.remove('token', { path: '/' }); Browsers are bitches about that. |
Same occurred to me a day ago. Passing { path: '/' } solves the problem. Thanks a lot! |
@eXon that was SUPER helpful! Thanks :) |
Does not work. >:( |
@destinatis can you be more precise about your issue? Please open a new one with steps to reproduce. |
To me it started removing only after I specified both path and domain: cookies.remove('token', { domain: COOKIE_DOMAIN, path: COOKIE_PATH }) |
@eXon It works in my case! THANKS |
Super help for me! thanks ! |
I'm experiencing the issue. Didn't help adding domain or path
I'm using Firefox Developer Edition in private mode. With chrome, it's working fine, even without the domain option. I suppose @eXon's comment "Browsers are bitches about that" is more true than I believed |
I'm having a similar problem except I can't even get it to remove in Chrome... @besil this issue is closed so you might want to open a new issue. |
I'm having a similar problem too. Did you find a solution @markjackson02 @besil ? |
Found out FF extensions did cause interference. In Chrome everything worked fine (I have no extensions there) |
Thanks for answering. Well, I think I have the same problem on Chrome where I have extensions but on Firefox it works fine. |
@MatthieuStadelmann My workaround is to use Express's |
Thanks @markjackson02 However, I don't use express in my React application. I need to be able to remove the cookies when the user logs out. |
@MatthieuStadelmann Can you use LocalStorage instead of cookies? In any case, I think this is deserving of a new issue. This one is closed so probably none of the devs of this package will see this thread. |
@markjackson02 No, for security purpose I can't. But you're right, I'll open a new thread if I can't find a solution :-) |
I had the same issue and could not figure out the problem - setting domain and path was not working. I don't know why but once i changed my function to an arrow function it works as expected. |
for me I used |
RemoveCookie function removed the cookie, but I had to refresh a signout component which called the function and solve an infinite loop problem out of the component because of the refreshing. |
you are KING |
This works, ty |
This solution has a flaw. After logged out if you refresh the page then it will login you back. At-least happened to me several times. Please others also check if this is a case or not. |
This happened to me in latest version because I deleted setCookie in const [cookie, removeCookie] = useCookies([...]); So removeCookie was being used as setCookie, just add it again: const [cookie, setCookie, removeCookie] = useCookies([...]); |
Thank you, this worked for me |
I did the same but the cookie is removing only after clicking it twice on the first click it removes and adds cookie back automatically even if i add setCookie |
I can't believe this is actually a problem with the library, but is there some condition in my application that could be causing behavior like what I'm observing in this console screenshot?
https://www.dropbox.com/s/805pyfznabpyr54/Screenshot%202016-02-02%2012.57.18.png?dl=0
Other pages in the application appear to be working as expected.
The text was updated successfully, but these errors were encountered: