Skip to content

Fix feedback submit: use useCustomMutation via ocotillo data provider#295

Open
jeremyzilar wants to merge 2 commits into
stagingfrom
fix/feedback-useCustomMutation
Open

Fix feedback submit: use useCustomMutation via ocotillo data provider#295
jeremyzilar wants to merge 2 commits into
stagingfrom
fix/feedback-useCustomMutation

Conversation

@jeremyzilar

Copy link
Copy Markdown
Contributor

Why

Bug and feature request submissions were failing on staging with:

Unexpected token '<', "<!DOCTYPE "... is not valid JSON

The panel was calling fetch('/api/feedback'), which only works in local dev via the Vite proxy. On App Engine, that URL returns the SPA's index.html, not the API.

What changed

Refactored handleSubmit in SupportPanel to use Refine's useCustomMutation with dataProviderName: 'ocotillo', as suggested in review. Submissions now go through ocotilloDataProvider.custom(), which:

  • Builds the URL from VITE_OCOTILLO_API_URL (works on staging and production)
  • Attaches the Bearer token via the existing axios auth interceptor
  • Uses TanStack Query for loading state (isPending) and mutation reset

How to test locally

  1. Run OcotilloAPI with Jira env vars set (JIRA_BASE_URL, JIRA_EMAIL, JIRA_API_TOKEN)
  2. Set VITE_OCOTILLO_API_URL=http://localhost:8000 in .env.development
  3. Start UI with npm run dev, log in, open Get Help, submit a bug
  4. In Network tab, confirm POST http://localhost:8000/feedback with Authorization: Bearer ... and a JSON response with jira_key

Files changed

File Change
src/components/AppShell.tsx useCustomMutation for feedback POST; removed manual fetch and submitState loading logic

…vider

Replaces raw fetch('/api/feedback') with Refine's useCustomMutation so
submissions go through ocotilloDataProvider.custom(). That fixes staging
and production where /api/feedback returned HTML instead of JSON, and
adds auth via the existing axios interceptor plus TanStack Query loading
and error handling.
@github-actions

Copy link
Copy Markdown

Preview Deployment

Preview URL: https://preview-fix-feedback-usecustommutation-auejgdbofq-uc.a.run.app

Note: This preview uses the staging API endpoints.

@github-actions

Copy link
Copy Markdown

Preview Deployment

Preview URL: https://preview-fix-feedback-usecustommutation-auejgdbofq-uc.a.run.app

Note: This preview uses the staging API endpoints.

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.

2 participants