-
Notifications
You must be signed in to change notification settings - Fork 523
Sketch Lab: support version history #69984
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
base: staging
Are you sure you want to change the base?
Conversation
molly-moen
left a comment
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.
Seems reasonable, one comment!
| if (onRestore) onRestore(startSources); | ||
| } else if (isLatest) { | ||
| dispatch(resetToCurrentVersion()); | ||
| if (onRestore) dispatch(resetToCurrentVersion({onRestore})); |
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.
should onRestore be required here to call resetToCurrentVersion? As-is will this cause broken behavior in Web Lab 2/Python lab?
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.
Yes guessing it will, thanks for the callout. Think I was just trying to avoid TS errors. I will tidy and request review!
fisher-alice
left a comment
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.
Nice! Just left a non-blocking comment/suggestion about using the term 'onRestore' in different contexts.
| } | ||
| if (viewingInitialVersion) { | ||
| dispatch(previewStartSources({startSources})); | ||
| dispatch(previewStartSources({startSources, onRestore})); |
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 wonder if 'restore' now has a bit of an overloaded meaning. Currently, it seems like 'restore' means to save whichever version is being selected as the most current version. But here it's only used to switch views temporarily.
Could use something more generic like 'onLoadVersion`?
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.
Good call, will update!
Adds version history to Sketch Lab. The approach here was to pass our handler that updates sources in
SourcesContainerto the version history component as a prop. Ideally, we'd like to unify these approaches to managing sources at some point in the future. More discussion in this Slack thread.Links
Testing story
Tested manually that I could view/restore intermediate versions, the initial version (with "start over" warning modal), and go back to the current version. Also tested that viewing a version made the canvas readonly and that changes were not saved if the page was reloaded after viewing (but not restoring) an old version.
Follow-up work
There's a UI to created named versions with a description, which relies on setting a bit of Redux state (
hasEdited) that Sketch Lab doesn't support yet. To simplify things, I'll do that as a follow-up.