Refreshing GPX list after importing a new GPX.
This commit is contained in:
1 parent
37fd31a040
commit
6c2573ba8b
6 files changed
+16
-12
No files matched your search
@@ -9,15 +9,15 @@ interface Props {
|
||||
map: () => OlMap | null;
|
||||
}
|
||||
|
||||
export const AllGpxes: Component<Props> = ({ map }) => {
|
||||
const [allGpxIds] = createResource(
|
||||
async () =>
|
||||
await dispatch({
|
||||
action: 'getAllGpxes',
|
||||
params: {},
|
||||
})
|
||||
);
|
||||
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
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user