delay activation

pull/4791/head
filip mertens 6 months ago
parent 200ab4d557
commit 652b3b3ef7
  1. 23
      libs/remix-ui/git/src/components/gitui.tsx

@ -48,17 +48,32 @@ export const GitUI = (props: IGitUi) => {
const [activePanel, setActivePanel] = useState<string>("0") const [activePanel, setActivePanel] = useState<string>("0")
const [setup, setSetup] = useState<boolean>(false) const [setup, setSetup] = useState<boolean>(false)
const [needsInit, setNeedsInit] = useState<boolean>(true) const [needsInit, setNeedsInit] = useState<boolean>(true)
const [appLoaded, setAppLoaded] = useState<boolean>(false)
useEffect(() => {
plugin.emit('statusChanged', {
key:'loading',
type: 'info',
title: 'Loading Git Plugin'
})
setTimeout(() => {
setAppLoaded(true)
}, 2000)
},[])
useEffect(() => { useEffect(() => {
if(!appLoaded) return
setCallBacks(plugin, gitDispatch, loaderDispatch) setCallBacks(plugin, gitDispatch, loaderDispatch)
setPlugin(plugin, gitDispatch, loaderDispatch) setPlugin(plugin, gitDispatch, loaderDispatch)
loaderDispatch({ type: 'plugin', payload: true }) loaderDispatch({ type: 'plugin', payload: true })
console.log(props) console.log(props)
}, []) }, [appLoaded])
useEffect(() => { useEffect(() => {
if(!appLoaded) return
async function checkconfig() { async function checkconfig() {
const username = await plugin.call('settings', 'get', 'settings/github-user-name') const username = await plugin.call('settings', 'get', 'settings/github-user-name')
const email = await plugin.call('settings', 'get', 'settings/github-email') const email = await plugin.call('settings', 'get', 'settings/github-email')
const token = await plugin.call('settings', 'get', 'settings/gist-access-token') const token = await plugin.call('settings', 'get', 'settings/gist-access-token')
@ -69,7 +84,7 @@ export const GitUI = (props: IGitUi) => {
}, [gitState.gitHubAccessToken, gitState.gitHubUser, gitState.userEmails]) }, [gitState.gitHubAccessToken, gitState.gitHubUser, gitState.userEmails])
useEffect(() => { useEffect(() => {
if(!appLoaded) return
async function setDecorators(gitState: gitState) { async function setDecorators(gitState: gitState) {
await plugin.call('fileDecorator', 'clearFileDecorators') await plugin.call('fileDecorator', 'clearFileDecorators')
await setModifiedDecorator(gitState.modified) await setModifiedDecorator(gitState.modified)
@ -83,7 +98,7 @@ export const GitUI = (props: IGitUi) => {
}, [gitState.fileStatusResult]) }, [gitState.fileStatusResult])
useEffect(() => { useEffect(() => {
if(!appLoaded) return
async function updatestate() { async function updatestate() {
console.log('updatestate', gitState) console.log('updatestate', gitState)
if (gitState.currentBranch && gitState.currentBranch.remote && gitState.currentBranch.remote.url) { if (gitState.currentBranch && gitState.currentBranch.remote && gitState.currentBranch.remote.url) {

Loading…
Cancel
Save