Refreshing GPX list after importing a new GPX.
This commit is contained in:
parent
37fd31a040
commit
6c2573ba8b
|
@ -9,15 +9,15 @@ interface Props {
|
|||
map: () => OlMap | null;
|
||||
}
|
||||
|
||||
export const AllGpxes: Component<Props> = ({ map }) => {
|
||||
const [allGpxIds] = createResource(
|
||||
const [allGpxIds, { refetch }] = createResource(
|
||||
async () =>
|
||||
await dispatch({
|
||||
action: 'getAllGpxes',
|
||||
params: {},
|
||||
})
|
||||
);
|
||||
);
|
||||
|
||||
export const AllGpxes: Component<Props> = ({ map }) => {
|
||||
createEffect(() => {
|
||||
console.log({ caller: 'AllGpxes', allGpxes: allGpxIds(), map: map() });
|
||||
});
|
||||
|
@ -34,3 +34,4 @@ export const AllGpxes: Component<Props> = ({ map }) => {
|
|||
};
|
||||
|
||||
export default AllGpxes;
|
||||
export { refetch };
|
||||
|
|
|
@ -1 +1 @@
|
|||
export { default } from './AllGpxes';
|
||||
export { default, refetch as refetchGpxList } from './AllGpxes';
|
||||
|
|
|
@ -9,6 +9,7 @@ import css from './GpxImport.module.css';
|
|||
import { findStartTime } from '../../lib/gpx';
|
||||
import dispatch from '../../workers/dispatcher-main';
|
||||
import { intToGpxId } from '../../lib/ids';
|
||||
import { refetchGpxList } from '../all-gpxes';
|
||||
|
||||
const GpxImport: Component = () => {
|
||||
const onChangeHandler = (event: any) => {
|
||||
|
@ -39,6 +40,7 @@ const GpxImport: Component = () => {
|
|||
},
|
||||
},
|
||||
});
|
||||
refetchGpxList();
|
||||
},
|
||||
false
|
||||
);
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* @refresh reload */
|
||||
import { render } from 'solid-js/web';
|
||||
import { Router, hashIntegration } from '@solidjs/router';
|
||||
|
||||
import App from './App';
|
||||
import dispatch from './workers/dispatcher-main';
|
||||
|
||||
/* // See https://stackoverflow.com/questions/71538643/property-wakelock-does-not-exist-on-type-navigator
|
||||
const requestWakeLock = async () => {
|
||||
|
@ -32,8 +32,6 @@ const handleVisibilityChange = () => {
|
|||
document.addEventListener('visibilitychange', handleVisibilityChange, false);
|
||||
requestWakeLock(); */
|
||||
|
||||
// Init the database
|
||||
dispatch({ action: 'initDb' });
|
||||
|
||||
render(
|
||||
() => (
|
||||
|
|
|
@ -19,6 +19,8 @@ export const init = () => {
|
|||
dispatcherQueue.queue.get(id)(null, payload);
|
||||
dispatcherQueue.queue.delete(id);
|
||||
};
|
||||
|
||||
dispatch({ action: 'initDb' });
|
||||
};
|
||||
|
||||
const dispatch = (
|
||||
|
|
|
@ -33,6 +33,7 @@ onmessage = async function (e) {
|
|||
const { id, payload } = e.data;
|
||||
var returnValue: any = 'unknownAction';
|
||||
if (payload.action in actions) {
|
||||
console.log({ caller: 'dispatcher-worker / awaiting', id, payload });
|
||||
returnValue = await actions[<keyof typeof actions>payload.action](
|
||||
payload.params
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue