Skip to content

Commit e5bd388

Browse files
nobioma1CompuIves
authored andcommitted
🔨Refactor /app/pages/GitHub/index.js (codesandbox#2657)
* Refactor to overmind and rename file extension to tsx * change to named import for GitHub component
1 parent 99e6051 commit e5bd388

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

packages/app/src/app/pages/GitHub/index.js renamed to packages/app/src/app/pages/GitHub/index.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
protocolAndHost,
88
gitHubRepoPattern,
99
} from '@codesandbox/common/lib/utils/url-generator';
10-
import { inject, hooksObserver } from 'app/componentConnectors';
10+
import { useOvermind } from 'app/overmind';
1111
import { Title } from 'app/components/Title';
1212
import { SubTitle } from 'app/components/SubTitle';
1313
import { Navigation } from 'app/pages/common/Navigation';
@@ -23,11 +23,15 @@ import {
2323
const getFullGitHubUrl = url =>
2424
`${protocolAndHost()}${gitHubToSandboxUrl(url)}`;
2525

26-
const GitHub = ({ signals: { githubPageMounted } }) => {
26+
export const GitHub = () => {
2727
const [error, setError] = useState(null);
2828
const [transformedUrl, setTransformedUrl] = useState('');
2929
const [url, setUrl] = useState('');
3030

31+
const {
32+
actions: { githubPageMounted },
33+
} = useOvermind();
34+
3135
useEffect(() => {
3236
githubPageMounted();
3337
}, [githubPageMounted]);
@@ -109,6 +113,3 @@ const GitHub = ({ signals: { githubPageMounted } }) => {
109113
</MaxWidth>
110114
);
111115
};
112-
113-
// eslint-disable-next-line import/no-default-export
114-
export default inject('signals')(hooksObserver(GitHub));

‎packages/app/src/app/pages/index.tsx‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ const Search = Loadable(() =>
4141
const CLI = Loadable(() => import(/* webpackChunkName: 'page-cli' */ './CLI'));
4242

4343
const GitHub = Loadable(() =>
44-
import(/* webpackChunkName: 'page-github' */ './GitHub')
44+
import(/* webpackChunkName: 'page-github' */ './GitHub').then(module => ({
45+
default: module.GitHub,
46+
}))
4547
);
4648
const CliInstructions = Loadable(() =>
4749
import(

0 commit comments

Comments
 (0)