Fix Garmin connect race, surface tool error content, add dev start scripts
- GarminConnection now flushes Profile's pending debounced autosave before
connecting, avoiding a race where Connect fires with stale credentials.
- client.go reads res.Content before checking IsError so tool error
messages actually include mcp-garmin's response text.
- seedsample: update kind lookups to match current taxonomy names
("Easy Run" -> "Easy", "Interval" -> "Intervals").
- Add backend/start.sh and frontend/start.sh dev launch scripts, and
check in CLAUDE.md.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -88,6 +88,18 @@ export function Profile({ onSaved }: { onSaved?: (p: ProfileType) => void }) {
|
||||
saveTimeoutRef.current = setTimeout(() => persist(next), AUTO_SAVE_DELAY_MS);
|
||||
}
|
||||
|
||||
// GarminConnection's "Connect" button reads credentials from the backend's
|
||||
// in-memory profile, which only updates once the debounced autosave above
|
||||
// actually fires -- clicking Connect right after typing a password would
|
||||
// otherwise race it and authenticate with stale (possibly empty) creds.
|
||||
async function flushPendingSave() {
|
||||
if (saveTimeoutRef.current) {
|
||||
clearTimeout(saveTimeoutRef.current);
|
||||
saveTimeoutRef.current = null;
|
||||
if (profileRef.current) await persist(profileRef.current);
|
||||
}
|
||||
}
|
||||
|
||||
if (!profile) {
|
||||
return (
|
||||
<div className="page">
|
||||
@@ -132,7 +144,7 @@ export function Profile({ onSaved }: { onSaved?: (p: ProfileType) => void }) {
|
||||
value={profile.BackfillHorizonDays}
|
||||
onChange={(v) => set("BackfillHorizonDays", v)}
|
||||
/>
|
||||
<GarminConnection />
|
||||
<GarminConnection onBeforeConnect={flushPendingSave} />
|
||||
</fieldset>
|
||||
|
||||
{/* TODO: these settings currently have no explanation in the UI --
|
||||
|
||||
Reference in New Issue
Block a user