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',
|
||||
},
|
||||
(error, result) => {
|
||||
console.log({
|
||||
caller: 'GpxChooser / getAllGpxesWithSummary',
|
||||
error,
|
||||
result,
|
||||
});
|
||||
if (!error) {
|
||||
setAllGpxes([
|
||||
{ id: 'new', name: t('newGpx'), creator: 'dyomedea' },
|
||||
|
|
|
@ -24,7 +24,7 @@ const GpxDialog: Component<{}> = (props) => {
|
|||
console.log({ caller: 'GpxDialog', currentGpxId: currentGpxId() });
|
||||
|
||||
const fetchGpx = (gpxId: string) => {
|
||||
if (gpxId === 'new') {
|
||||
if (gpxId === 'new' || !gpxId) {
|
||||
return newEmptyGpx();
|
||||
}
|
||||
const newGpx = peekCachedSignal({
|
||||
|
@ -43,9 +43,7 @@ const GpxDialog: Component<{}> = (props) => {
|
|||
|
||||
const handleClickOpen = async () => {
|
||||
setOpen(true);
|
||||
if (currentGpxId() !== '') {
|
||||
setGpx(fetchGpx(currentGpxId()) as Gpx);
|
||||
}
|
||||
setGpx(fetchGpx(currentGpxId()) as Gpx);
|
||||
console.log({
|
||||
caller: 'GpxDialog / handleClickOpen',
|
||||
currentGpxId: currentGpxId(),
|
||||
|
|
|
@ -1,17 +1,12 @@
|
|||
import {
|
||||
Component,
|
||||
createEffect,
|
||||
createResource,
|
||||
createSignal,
|
||||
For,
|
||||
onCleanup,
|
||||
Suspense,
|
||||
} 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 VectorSource from 'ol/source/Vector';
|
||||
|
|
|
@ -421,7 +421,7 @@ export const putGpx = async (params: any) => {
|
|||
let { id, gpx } = params;
|
||||
|
||||
try {
|
||||
if (id === 'new') {
|
||||
if (id === 'new' || !id) {
|
||||
const date = !!gpx.metadata.time
|
||||
? new Date(gpx.metadata.time)
|
||||
: new Date();
|
||||
|
|
Loading…
Reference in New Issue