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