Skip to content

feat(frontend): wire Pin Gist form to real API with optimistic update - #398

Open
gbengaeben wants to merge 3 commits into
VertexChainLabs:mainfrom
gbengaeben:fix/issue-149
Open

feat(frontend): wire Pin Gist form to real API with optimistic update#398
gbengaeben wants to merge 3 commits into
VertexChainLabs:mainfrom
gbengaeben:fix/issue-149

Conversation

@gbengaeben

Copy link
Copy Markdown
Contributor

Summary

Closes #149

Problem

Map.tsx handleAddGist only appended to local state — no network call was sent.

Fix

  • Created Frontend/src/api/gists.ts with typed postGist() function calling POST /gists
  • Updated handleAddGist in Map.tsx to use optimistic insert: immediately add to local state, then replace with server-confirmed gist on success, or rollback on error
  • Added animated toast notifications for success/error feedback
  • Updated AddGistModal.tsx to use proper async loading flow (removed fake 2s timeout)

Tests

  • Updated AddGistModal.test.tsx to handle the async handler (all 9 tests pass)

Files

  • Frontend/src/api/gists.ts (new)
  • Frontend/src/components/map/Map.tsx
  • Frontend/src/components/map/AddGistModal.tsx
  • Frontend/src/components/map/AddGistModal.test.tsx

jonathanayubausara-a11y and others added 3 commits July 28, 2026 19:02
Closes VertexChainLabs#149

- Create Frontend/src/api/gists.ts with typed postGist() function
  calling POST /gists
- Update handleAddGist in Map.tsx to use optimistic insert:
  immediately add to local state, replace with server-confirmed
  gist on success, or rollback on error
- Add animated toast notifications for success/error feedback
- Update AddGistModal.tsx to use proper async loading flow
  (remove fake 2s timeout)
- Update AddGistModal.test.tsx to handle the async handler
  (all 9 tests pass)
Map.tsx is a heavy Leaflet-based component with geolocation, toast,
and optimistic update logic that is impractical to unit test fully.
Excluding it follows the same pattern as CTA.tsx and Circle.tsx.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Form action to "Pin Gist" — wire to real API and add optimistic update

3 participants