Rename var

Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>
This commit is contained in:
Tilman Vatteroth 2020-05-30 22:35:47 +02:00 committed by mrdrogdrog
parent 7ef1b086bd
commit afb2ea85b1

View file

@ -10,7 +10,7 @@ export const ApplicationLoader: React.FC = ({ children }) => {
const [doneTasks, setDoneTasks] = useState<number>(0) const [doneTasks, setDoneTasks] = useState<number>(0)
const [initTasks, setInitTasks] = useState<InitTask[]>([]) const [initTasks, setInitTasks] = useState<InitTask[]>([])
const { pathname } = useLocation() const { pathname } = useLocation()
const [applicationLoading, setApplicationLoading] = useState<boolean>(false) const [tasksAlreadyTriggered, setTasksAlreadyTriggered] = useState<boolean>(false)
const runTask = async (task: Promise<void>): Promise<void> => { const runTask = async (task: Promise<void>): Promise<void> => {
await task await task
@ -20,14 +20,14 @@ export const ApplicationLoader: React.FC = ({ children }) => {
} }
useEffect(() => { useEffect(() => {
if (applicationLoading) { if (tasksAlreadyTriggered) {
return return
} }
setApplicationLoading(true) setTasksAlreadyTriggered(true)
const baseUrl:string = window.location.pathname.replace(pathname, '') + '/' const baseUrl:string = window.location.pathname.replace(pathname, '') + '/'
console.debug('Base URL is', baseUrl) console.debug('Base URL is', baseUrl)
setInitTasks(setUp(baseUrl)) setInitTasks(setUp(baseUrl))
}, [applicationLoading, pathname]) }, [tasksAlreadyTriggered, pathname])
useEffect(() => { useEffect(() => {
for (const task of initTasks) { for (const task of initTasks) {