fix: useAppInitEffect not working
This commit is contained in:
parent
f8d9b437c2
commit
ce8253571e
@ -1,3 +1,4 @@
|
||||
import { useAppInitEffect } from '@renderer/hooks/useAppInitEffect'
|
||||
import { message, Modal } from 'antd'
|
||||
import { findIndex, pullAt } from 'lodash'
|
||||
import React, { useEffect, useState } from 'react'
|
||||
@ -21,6 +22,8 @@ const TopViewContainer: React.FC<Props> = ({ children }) => {
|
||||
const [messageApi, messageContextHolder] = message.useMessage()
|
||||
const [modal, modalContextHolder] = Modal.useModal()
|
||||
|
||||
useAppInitEffect()
|
||||
|
||||
onPop = () => {
|
||||
const views = [...elements]
|
||||
views.pop()
|
||||
|
||||
@ -9,12 +9,9 @@ export function useAppInitEffect() {
|
||||
|
||||
useEffect(() => {
|
||||
runAsyncFunction(async () => {
|
||||
try {
|
||||
const storedImage = await LocalStorage.getImage('avatar')
|
||||
storedImage && dispatch(setAvatar(storedImage))
|
||||
} catch (error) {
|
||||
console.error('Error retrieving the image', error)
|
||||
}
|
||||
const storedImage = await LocalStorage.getImage('avatar')
|
||||
storedImage && dispatch(setAvatar(storedImage))
|
||||
console.debug('Avatar loaded from storage')
|
||||
})
|
||||
}, [dispatch])
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user