Bug fix when creating the first gpx.
This commit is contained in:
parent
51ab7c38e0
commit
1d5d158f8c
|
@ -23,6 +23,11 @@ const GpxChooser: Component<Props> = (props: Props) => {
|
||||||
action: 'getAllGpxesWithSummary',
|
action: 'getAllGpxesWithSummary',
|
||||||
},
|
},
|
||||||
(error, result) => {
|
(error, result) => {
|
||||||
|
console.log({
|
||||||
|
caller: 'GpxChooser / getAllGpxesWithSummary',
|
||||||
|
error,
|
||||||
|
result,
|
||||||
|
});
|
||||||
if (!error) {
|
if (!error) {
|
||||||
setAllGpxes([
|
setAllGpxes([
|
||||||
{ id: 'new', name: t('newGpx'), creator: 'dyomedea' },
|
{ id: 'new', name: t('newGpx'), creator: 'dyomedea' },
|
||||||
|
|
|
@ -24,7 +24,7 @@ const GpxDialog: Component<{}> = (props) => {
|
||||||
console.log({ caller: 'GpxDialog', currentGpxId: currentGpxId() });
|
console.log({ caller: 'GpxDialog', currentGpxId: currentGpxId() });
|
||||||
|
|
||||||
const fetchGpx = (gpxId: string) => {
|
const fetchGpx = (gpxId: string) => {
|
||||||
if (gpxId === 'new') {
|
if (gpxId === 'new' || !gpxId) {
|
||||||
return newEmptyGpx();
|
return newEmptyGpx();
|
||||||
}
|
}
|
||||||
const newGpx = peekCachedSignal({
|
const newGpx = peekCachedSignal({
|
||||||
|
@ -43,9 +43,7 @@ const GpxDialog: Component<{}> = (props) => {
|
||||||
|
|
||||||
const handleClickOpen = async () => {
|
const handleClickOpen = async () => {
|
||||||
setOpen(true);
|
setOpen(true);
|
||||||
if (currentGpxId() !== '') {
|
setGpx(fetchGpx(currentGpxId()) as Gpx);
|
||||||
setGpx(fetchGpx(currentGpxId()) as Gpx);
|
|
||||||
}
|
|
||||||
console.log({
|
console.log({
|
||||||
caller: 'GpxDialog / handleClickOpen',
|
caller: 'GpxDialog / handleClickOpen',
|
||||||
currentGpxId: currentGpxId(),
|
currentGpxId: currentGpxId(),
|
||||||
|
|
|
@ -1,17 +1,12 @@
|
||||||
import {
|
import {
|
||||||
Component,
|
Component,
|
||||||
createEffect,
|
createEffect,
|
||||||
createResource,
|
|
||||||
createSignal,
|
|
||||||
For,
|
For,
|
||||||
onCleanup,
|
onCleanup,
|
||||||
Suspense,
|
Suspense,
|
||||||
} from 'solid-js';
|
} from 'solid-js';
|
||||||
|
|
||||||
import OlMap from 'ol/Map';
|
|
||||||
|
|
||||||
import dispatch, { cancelDispatch } from '../../workers/dispatcher-main';
|
|
||||||
import getUri from '../../lib/ids';
|
|
||||||
|
|
||||||
import Trkseg from '../trkseg';
|
import Trkseg from '../trkseg';
|
||||||
import VectorSource from 'ol/source/Vector';
|
import VectorSource from 'ol/source/Vector';
|
||||||
|
|
|
@ -421,7 +421,7 @@ export const putGpx = async (params: any) => {
|
||||||
let { id, gpx } = params;
|
let { id, gpx } = params;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (id === 'new') {
|
if (id === 'new' || !id) {
|
||||||
const date = !!gpx.metadata.time
|
const date = !!gpx.metadata.time
|
||||||
? new Date(gpx.metadata.time)
|
? new Date(gpx.metadata.time)
|
||||||
: new Date();
|
: new Date();
|
||||||
|
|
Loading…
Reference in New Issue