Skip to content
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

local storage to make the calorie count persist. make count persist incase of tab closure #3

Open
gnaaruag opened this issue May 30, 2024 · 4 comments

Comments

@gnaaruag
Copy link

Hey Andrej, love how uncomplicated and practical this is. if you are open to it, i would like to suggest making it so the calorie data is persistant with the help of browser local storage. so that whatever calories we do add or subtract persist in case of closure of the tab. if its ok i would love to make a pr for this.

@gnaaruag gnaaruag changed the title local storage to make the calorie count persist. help data persist incase of tab closure local storage to make the calorie count persist. help calorie count persist incase of tab closure May 30, 2024
@gnaaruag gnaaruag changed the title local storage to make the calorie count persist. help calorie count persist incase of tab closure local storage to make the calorie count persist. make count persist incase of tab closure May 30, 2024
@karpathy
Copy link
Owner

I'm possibly open to it, I didn't do this because I was worried local storage is exotic enough feature that it opens doors to 100 issues of the type "on my computer X browser Y it doesn't work why". I just don't close the tab :D. But I'm not familiar with the current state of local storage support among platforms and browsers.

@gnaaruag
Copy link
Author

local storage is very practical for this sort of application, and is supported by every commericial browser, your point does make sense, it would be better to just keep the tab open, but at the same time we could implement browser local storage as a safety mechanism, so in case you accidentally close the tab you dont loose the day's progress.

@karpathy
Copy link
Owner

Maybe if it can be done in a very defensive, highly optional way, so it works just fine without it, in the current way.

@gnaaruag
Copy link
Author

gnaaruag commented May 30, 2024

could add a checkbox to opt in or out of data persistence to my pr or can drop the whole thing, your call really! but as far as i can tell my current pr shouldnt cause any issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants