Cleanup indexes at start time and waith till the cleanup is done before rendering the whiteboard.
This commit is contained in:
1 parent
fafde7b831
commit
e1da4a1e4a
2 files changed
+53
-23
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import react, { useMemo, useEffect } from 'react';
|
||||
import react, { useMemo, useEffect, useState } from 'react';
|
||||
import { useDispatch } from 'react-redux';
|
||||
import { mapActions } from '../../store/map';
|
||||
import _ from 'lodash';
|
||||
@@ -36,9 +36,12 @@ const Map: react.FC<{}> = (props: {}) => {
|
||||
);
|
||||
|
||||
const db = useDB();
|
||||
|
||||
const [dbReady, setDbReady] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
window.addEventListener('resize', debouncedResizeHandler);
|
||||
initDb(db);
|
||||
initDb(db, setDbReady);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
@@ -48,7 +51,7 @@ const Map: react.FC<{}> = (props: {}) => {
|
||||
<Slippy>
|
||||
<Whiteboard>
|
||||
<CurrentLocation />
|
||||
<Gpxes />
|
||||
dbReady && <Gpxes />
|
||||
</Whiteboard>
|
||||
<Layer>
|
||||
<TiledMap />
|
||||
|
||||
Reference in new issue
Block a user