Skip to content

Commit

Permalink
refactor: Optimize loading process in MagickIDE component
Browse files Browse the repository at this point in the history
  • Loading branch information
HaruHunab1320 committed Jun 15, 2024
1 parent aa561ad commit 2ed8836
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/client/editor/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
*/
import React, { useEffect, useState } from 'react'
import { Provider } from 'react-redux'

import 'regenerator-runtime/runtime'

import App from './App'
import AppProviders from './contexts/AppProviders'
import { AppConfig } from '@magickml/providers'
Expand Down Expand Up @@ -48,12 +46,12 @@ export const MagickIDE = ({
}: MagickIDEProps): React.ReactElement | null => {
const loading = useState(true)
const loadingStatus = useState(LoadingStatus.INITIALIZING)

useEffect(() => {
;(async () => {
loadingStatus[1](LoadingStatus.CONNECTING)
await feathersClient.initialize(config.token, config)
loading && loading[1](false)
loading[1](false)
loadingStatus[1](LoadingStatus.READY)
})()
}, [config, loading])
Expand All @@ -63,12 +61,14 @@ export const MagickIDE = ({
return (
<Provider store={createStore(config)}>
<AppProviders config={config}>
<div className="flex flex-col h-screen w-full">
<div className="flex flex-col w-full h-full overflow-hidden">
<TopBar
rightTopBarItems={rightTopBarItems}
leftTopBarItems={leftTopBarItems}
/>
<App />
<div className="flex-grow overflow-auto">
<App />
</div>
</div>
</AppProviders>
</Provider>
Expand Down

0 comments on commit 2ed8836

Please sign in to comment.