Skip to content

Commit

Permalink
refactor: isolate setupRepo func
Browse files Browse the repository at this point in the history
  • Loading branch information
nadilas committed Apr 7, 2024
1 parent 6f7b9d2 commit 2064783
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions apps/ogre-demo/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const Home: NextPage = () => {
<LivePreview
style={{
borderRadius: `${polished.rem(0)} ${polished.rem(
5
5,
)} ${polished.rem(5)} ${polished.rem(0)}`,
position: "relative",
padding: "0.5rem",
Expand Down Expand Up @@ -120,11 +120,11 @@ const code = `
const [repository, setRepository] = useState(undefined)
useEffect(() => {
if (!repository) {
setupRepo()
setupRepo().then(r => setRepository(r))
}
return () => setRepository(undefined)
}, [])
const setupRepo = async () => {
let author = 'author <[email protected]>'
const r = new Repository({description: '', name: ''}, {})
Expand All @@ -147,8 +147,8 @@ const code = `
r.checkout('main')
r.merge('description')
setRepository(r)
return r
}
return repository ? <OgreGraph repository={repository} /> : null
}`;

0 comments on commit 2064783

Please sign in to comment.