Remove sync parseGpx, use parseGpxAsync everywhere
parseGpx (sync) needs browser DOMParser which doesn't exist on the server — it silently failed in every server-side caller. Removed the export and migrated all callers to parseGpxAsync. Updated tests. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
d5bcecb345
commit
5f3d4ae846
5 changed files with 29 additions and 21 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import { redirect, data } from "react-router";
|
||||
import type { Route } from "./+types/new";
|
||||
import { createSession, initializeSessionWithWaypoints } from "~/lib/sessions";
|
||||
import { parseGpx } from "@trails-cool/gpx";
|
||||
import { parseGpxAsync } from "@trails-cool/gpx";
|
||||
import { checkRateLimit } from "~/lib/rate-limit";
|
||||
|
||||
export async function loader({ request }: Route.LoaderArgs) {
|
||||
|
|
@ -35,7 +35,7 @@ export async function loader({ request }: Route.LoaderArgs) {
|
|||
if (gpxEncoded) {
|
||||
try {
|
||||
const gpx = decodeURIComponent(gpxEncoded);
|
||||
const gpxData = parseGpx(gpx);
|
||||
const gpxData = await parseGpxAsync(gpx);
|
||||
initializeSessionWithWaypoints(session.id, gpxData.waypoints);
|
||||
} catch {
|
||||
// Continue with empty session if GPX is invalid
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue