-
Notifications
You must be signed in to change notification settings - Fork 8
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
BugFix for two clippings get removed instead of one when removing clip #27
Conversation
hi @kavisherlock , Thanks for the PR and well done for knowing the issue :) Please note that there is another PR that adds the export option With your solution, when exporting we will need also to convert each UTC timestamp again to toLocaleString What you think? maybe saving both of them is useful? |
I personally don't think we need to save both. They both convey the same info and having both just leaves potential for someone to accidentally change one without changing the other |
@kavisherlock I agree, its better to have one source of data, if we kept two sources of data (timestamp and display time) it can be source of bugs later when something changes, then we will need to change in two places the code looks good, but I will test it a little bit later and merge |
Hi @kavisherlock export to JSON PR just got merged please rebase from master and your changes to work with the new export functionality Thanks |
@kavisherlock looks good, please squash to one commit and I will merge resources that can help to squash: https://stackoverflow.com/questions/14534397/squash-all-my-commits-into-one-for-github-pull-request https://medium.com/@mittalyashu/how-to-squash-commits-in-a-github-pull-request-97b36576eacb |
hmm. it keeps telling me to also squash the export commits into mine. Can you not do a squash and merge? |
you can either do squash or rebase also, the export commit is already in master |
Okay. The rebase finally worked |
Fix for #26
The issue was that the clips were using the timestamp as the unique identifier, particularly during deletion. However, the timestamp generated with toLocaleString is in format MM/DD/YYYY, HH:MM:SS AM/PM. This means that if two clips were made very quickly, within the same second, they would have the same timestamp. And therefore, removing one would remove the other
My suggested fix is to use the true UTC timestamp as the "creationDate" for clips and as the unique identifier. This is in milliseconds therefore two clips will never have the same creationDate. And only for displaying it do we go back to calling toLocaleString