-
Notifications
You must be signed in to change notification settings - Fork 247
feat: lastModified and db for diagram list COMPASS-9398 #6951
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
Conversation
| ); | ||
| return { | ||
| ...item, | ||
| lastModified: Date.parse(item.edits[item.edits.length - 1].timestamp), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think when we usually refer to last modified we specifically mean when the file was saved by the storage, wouldn't it be easier to just write this value as part of the store logic instead of recalculating it here all the time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah might be. Following the tech design here. We could achieve the same if we always save the last edit's timestamp also on the top level. But I'm actually not sure if lastModified should work like this with the undo. Shouldn't undo also count as modification? In that case we definitely need to store this. cc @Anemy - sorry that I didn't notice this when reviewing the design
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You also have a case of changing the name which counts as modification I think. Applying undo might also get confusing if we just use the timestamps (like imaging undoing to something that was timestamped a long time ago and the item that you might expect at the top is not at the bottom of the list). I really don't think we want to bind stored file modification action to edits themselves
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated. I didn't remove the timestamp on edits, even though I'm not sure we need that one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: If you had saved diagrams before you'll probably see errors because they miss the new fields. Just ignore and create new diagrams.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Saving the last modified intentionally instead of relying on the edit timestamps sounds good 👍
f6f473b to
cedbeff
Compare
cedbeff to
71ac9b0
Compare
71ac9b0 to
50d0369
Compare
Description
Note: I made the cards a bit smaller than the designs, they looked too empty with only the db.

Overloads confusion
Hooks can't be called conditionally, so I made the hook useFormattedDate hook accept optional value. In that case the return type is of course optional too. This is represented with function overload. Unfortunately, the overloaded type is getting lost somewhere in the exports/imports, so in the end there is only one function signature.
Update:
I figured out what works - to repeat the overload signature. Looks like the last one is not transferred. I am still confused.
Checklist
Motivation and Context
Open Questions
Dependents
Types of changes