elliotforwater.com
elliotforwater.com copied to clipboard
Fix: Move search count from cookie to local storage
We are considering saving search count to localStorage instead of cookies mostly to not have an expiration date. Everything else should stay the same.
Happy to hear feedbacks about that.
Hello, @gsambrotta and @ElliotForWater/elliotforwater-core-dev! I've been newly acquainted with your project and would love to help! Are you still working on this issue? If so, I'd be happy to take it on.
Hi @KitanGarcia Thank you for your interest in contributing to Elliot for Water. Yes this issue is still needed. Right now we are saving the search count (what you see next to the drop icon, in the right top corner of the header) as cookies but doing so we do an extra call to the server and we also have an expiration date. We were considering moving to the local storage for those reasons.
Any pro or cons you see in these solutions? Let me know what do you think and if you need any other information.
Thanks for the response, @gsambrotta . After doing some research on my end, I do think that going with LocalStorage is the best way to go about things, due to exactly what you've mentioned.
Unfortunately, I'm actually unable to get the project running at the moment. It must be some rookie mistake on my part somewhere. I'm following this link: https://github.com/ElliotForWater/elliotforwater.com/wiki/1.-Set-up-and-usage Can you help?
After cloning and entering the repo, I ran:
npm install
npm run dev
I got an error pertaining to env-cmd, so I tried some suggestions on stack overflow (running different commands and using -e instead of -f), and also installed env-cmd globally. I have not modified the dev script in package.json at all. When I run npm run dev
, the error I have now is Error: Failed to find .env file at path: .env.development at getEnvFile (/home/kitan/Projects/orgs/ElliotForWater/efw-webapp/node_modules/env-cmd/dist/get-env-vars.js:40:19)
@KitanGarcia The .env
file is missing. In your copy of the project, you should have a file called .env.development.example
, If you open it you will see a comment that says to copy that file and rename it .env.development
After doing that, npm run dev
should run without problem.
I will add this part to the documentation. Thank you for mentioning
@gsambrotta Just to clarify, you just want the search count to be moved to local storage, correct? The rest of the cookies stay as cookies and do not be made part of local storage?
Yes, for the moment we can move just the search count. Then we can see later about the other cookies. Thanks @KitanGarcia