-
Notifications
You must be signed in to change notification settings - Fork 2.4k
🔨 Refactored 🧠 Overmind : /editor/content/preview/index to replace Cerebral with Overmind #2638
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
|
This pull request is automatically deployed with Now. Latest deployment for this branch: https://codesandbox-cl-git-fork-chinmay17-refactor-editor-conten-98b27a.codesandbox1.now.sh |
|
I need help with 2 things.
Here, the type for but in I tried finding these definitions in Overmind's repo, but couldn't find the branch for v20.
How do I add I tried doing but it doesn't work. Because of Any help is appreciated. |
|
Hmm, this is definitely one for @christianalfoni and @CompuIves to take a look at. The Preview component is one of the more complex parts of the app. I won't have time in the next day to help with debugging this, but if neither of them get back to you by next week I'll take a look. Thanks for taking this one on! |
|
Thank you @Saeris for the prompt response. Will wait for the help. :) |
|
@chinmay17 You are perfectly right about the typing issue with Reaction. This is actually fixed in The second issue if from old mobx code. You do not have to check for |
83402cb to
dd85ed7
Compare
|
@christianalfoni Thank you for helping me out here. I have updated the code accordingly. Had to fix some code in Waiting for your comments. :) |
christianalfoni
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.
Great stuff! :) Yeah, I made the same fix on onInitialize in the other branch as well. Maybe I can just close that other PR actually and we can rather get this one in
|
@christianalfoni thank you for the review. Let me know if any changes are required. :) |
Saeris
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.
Pointed out a few things that stood out to me that should be changed. Otherwise this looks good to me but we should definitely thoroughly test this and I believe @CompuIves should definitely give this one a look over.
| import RunOnClick from '@codesandbox/common/lib/components/RunOnClick'; | ||
| import getTemplate from '@codesandbox/common/lib/templates'; | ||
|
|
||
| type Props = { |
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.
Can we change this to an interface? Following the convention this would be IPreviewProps
| type Props = { | |
| interface IPreviewProps { |
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.
Changed. Sorry that I missed it out.
| .concat( | ||
| sandbox.directories.map( | ||
| directory => directory.directoryShortid + directory.title | ||
| const PreviewComponent: React.FC<Props> = ({ |
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.
| const PreviewComponent: React.FC<Props> = ({ | |
| export const Preview: React.FC<IPreviewProps> = ({ |
Just export the component directly, no need to declare the function then re-export it at the end of the file. I'm assuming the thought behind this is to ensure that the component has a display name in the React dev tools, for which we're using a Babel plugin that handles this automatically.
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.
Thank you. Updated. :)
| ); | ||
| }; | ||
|
|
||
| export const Preview = PreviewComponent; |
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.
| export const Preview = PreviewComponent; |
Let's just remove this entirely, no need to rename the component and export this way.
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.
done
dd85ed7 to
cd12f7b
Compare
|
Build for latest commit cd12f7b is at https://pr2638.build.csb.dev/s/new. |
|
@chinmay17 I am really sorry, but the Really awesome work on this though, tricky one to get right and it looks great 👍 😄 |
What kind of change does this PR introduce?
Refactors code as a part of hacktoberfest mentioned in #2621.
@Saeris @christianalfoni
What is the current behavior?
/editor/content/preview/index.tsx was using app/componentConnectors
What is the new behavior?
uses
useOvermindfromapp/overmindWhat steps did you take to test this?
Tested the Preview component by making changes in the code, adding/removing dependencies
Checklist