Restore deleted sprite.#2824
Conversation
rschamp
left a comment
There was a problem hiding this comment.
This looks great overall!
src/containers/deletion-restorer.jsx
Outdated
| ...props | ||
| } = this.props; | ||
| props.restorable = typeof this.props.restore === 'function'; | ||
| props.deletedItem = this.props.deletedItem; |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
src/components/menu-bar/menu-bar.jsx
Outdated
| <DeletionRestorer>{(handleRestore, {restorable, deletedItem}) => ( | ||
| <MenuItem | ||
| className={classNames({[styles.disabled]: !restorable})} | ||
| onClick={handleRestore} |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
|
@rschamp, I addressed the comments you made. One thing I have a question about is that I am getting warnings in the console, and I'm not exactly sure where they're coming from (this was happening prior to the last commit as well). Any ideas?: |
|
That warning happens when you use |
|
I didn't notice the second error referencing |
rschamp
left a comment
There was a problem hiding this comment.
Thanks for making those changes, still keeping as needs work for the prop type errors.
|
@rschamp thanks for explaining those warnings! I fixed the second one, but found that the first one is actually already on develop because there aren't any places in this PR where I'm using For that second warning, react was only complaining about the specific instance of |
rschamp
left a comment
There was a problem hiding this comment.
Thanks for fixing up the dispatchupdateRestore prop. Like we talked about offline, it's good that you cleaned it up even in the instance where it has no effect for future-proofing. It wasn't causing an issue because you omitted it in the implementation: https://github.com/LLK/scratch-gui/pull/2824/files#diff-8d887729f7ca8c4b671c7a4ecd6f0c2bR290 — if you had used props rather than {restorable, deletedItem} and then used ...props in a child component, you would have seen it pop up.

Resolves
Towards implementing 'undelete' functionality from 2.0.
Proposed Changes
Not Addressed By This PR
Related PRs
Depends on scratchfoundation/scratch-vm#1438, and tests will fail until that PR is merged in.
Test Coverage
Manual testing. Changes can be tested at https://llk.github.io/scratch-gui/restore-sprite
Browser Coverage
Check the OS/browser combinations tested (At least 2)
Mac
Windows
Chromebook
iPad
Android Tablet