diff --git a/src/components/map/GpxExport.tsx b/src/components/map/GpxExport.tsx index b05bc99..4096330 100644 --- a/src/components/map/GpxExport.tsx +++ b/src/components/map/GpxExport.tsx @@ -39,7 +39,7 @@ const GpxExport: React.FC<{ gpx: any }> = (props: { gpx: any }) => { const filenameToTest = i === 0 ? `${filename}.${extension}` : `${filename}(${i}).${extension}`; try { - const statResult = await Filesystem.stat({ + await Filesystem.stat({ path: filenameToTest, directory: Directory.Documents, }); diff --git a/src/components/map/GpxRecord.tsx b/src/components/map/GpxRecord.tsx index 63a7005..d633c35 100644 --- a/src/components/map/GpxRecord.tsx +++ b/src/components/map/GpxRecord.tsx @@ -1,4 +1,4 @@ -import React, { Fragment, useEffect, useRef, useState } from 'react'; +import React, { Fragment, useRef, useState } from 'react'; import { useDB, useFind } from 'react-pouchdb'; diff --git a/src/components/map/Settings.tsx b/src/components/map/Settings.tsx index 8a960ae..592da6e 100644 --- a/src/components/map/Settings.tsx +++ b/src/components/map/Settings.tsx @@ -1,4 +1,4 @@ -import React, { Fragment, useEffect, useRef, useState } from 'react'; +import React, { Fragment, useEffect, useRef } from 'react'; import { useDB } from 'react-pouchdb'; @@ -16,7 +16,7 @@ import { IonTitle, IonToolbar, } from '@ionic/react'; -import { options, text } from 'ionicons/icons'; +import { options } from 'ionicons/icons'; import { enterAnimation, leaveAnimation } from '../../lib/animation'; import { useDispatch, useSelector } from 'react-redux'; import { settingsActions, SettingsState } from '../../store/settings'; @@ -38,7 +38,7 @@ const Settings: React.FC<{}> = () => { } catch {} }; initFromDb(); - }, []); + }, [db, dispatch]); const settingsState = useSelector( (state: { settings: SettingsState }) => state.settings @@ -65,7 +65,7 @@ const Settings: React.FC<{}> = () => { }; settingsFromRedux(); } - }, [settingsState]); + }, [db, settingsState]); const pseudo = useRef(null); const minTimeInterval = useRef(null); diff --git a/src/components/map/TracksBrowser.tsx b/src/components/map/TracksBrowser.tsx index 635fd21..d2876f9 100644 --- a/src/components/map/TracksBrowser.tsx +++ b/src/components/map/TracksBrowser.tsx @@ -10,12 +10,11 @@ import { IonItem, IonList, IonModal, - IonSpinner, IonTitle, IonToolbar, } from '@ionic/react'; import { trash } from 'ionicons/icons'; -import React, { Fragment, Suspense, useRef } from 'react'; +import React, { Fragment, useRef } from 'react'; import { useFind, useDB } from 'react-pouchdb'; import { deleteGps } from '../../db/gpx'; import { enterAnimation, leaveAnimation } from '../../lib/animation'; diff --git a/src/components/map/gpxes.tsx b/src/components/map/gpxes.tsx index 472a97a..ef8c0c0 100644 --- a/src/components/map/gpxes.tsx +++ b/src/components/map/gpxes.tsx @@ -1,4 +1,4 @@ -import React, { Suspense } from 'react'; +import React from 'react'; import { useFind } from 'react-pouchdb'; diff --git a/src/components/map/map.tsx b/src/components/map/map.tsx index 84e1e4c..741169e 100644 --- a/src/components/map/map.tsx +++ b/src/components/map/map.tsx @@ -27,7 +27,7 @@ import TileServerChooserDialog from './TileServerChooserDialog'; import TrackBrowser from './TracksBrowser'; import Settings from './Settings'; -const Map: react.FC<{}> = (props: {}) => { +const Map: react.FC<{}> = () => { const dispatch = useDispatch(); const resizeHandler = () => { diff --git a/src/db/gpx.ts b/src/db/gpx.ts index c49ae85..555d63c 100644 --- a/src/db/gpx.ts +++ b/src/db/gpx.ts @@ -49,13 +49,11 @@ export const pushGpx = async (db: any, payload: any) => { for (var point in points) { const docPoint = { type: 'trkpt', gpx: _id, trkpt: points[point] }; console.log(JSON.stringify(docPoint)); - const response = await db.post(docPoint); + await db.post(docPoint); console.log(JSON.stringify(docPoint)); } }; -const CURRENT_GPX = '---current gpx---'; - const initialGpx = { type: 'gpx', subtype: 'current', @@ -187,6 +185,7 @@ export const getGpx = async (db: any, gpxId: string) => { ); trkpts.map((trkptDoc: any) => { gpx.trk[0].trkseg[0].trkpt.push(trkptDoc.trkpt); + return undefined; }); return gpx; }; diff --git a/src/db/index.ts b/src/db/index.ts index e3a678a..6203674 100644 --- a/src/db/index.ts +++ b/src/db/index.ts @@ -1,4 +1,4 @@ -import _, { constant } from 'lodash'; +import _ from 'lodash'; import uri from '../lib/ids'; const dbDefinitionId = uri('dbdef', {}); @@ -74,7 +74,7 @@ export const initDb = async (db: any, setDbReady: any) => { } } - for (var index of requiredIndexes) { + for (index of requiredIndexes) { if (!findIndex(existingIndexes, index)) { // console.log(`db.createIndex(${JSON.stringify(index)})`); await db.createIndex({ name: index.name, ...index.def });