openapi
Technical notes on web development, DevOps, and AI integration.
2 articles
- 09:29frontend
The Tri-State Trap in React Category Pickers
A dropdown that is right for create is wrong for edit. A tri-state moduleScope makes the fetch wait for the entity to load.
TL;DR: Editing showed PARIWISATA categories instead of KEPEMUDAAN because the picker fetched before the module loaded and fell back to the default. The fix makes moduleScope tri-state and waits until it resolves before calling listAdminCategories via useEffect. The team also synced the OpenAPI spec, generated types, and frontend module list to prevent enum drift.
#react#typescript#openapi - 04:23backend
XLSX Export from Go, and the Binary Guess That Missed
openapi-fetch does have parseAs blob. The friction is binary-format typing and the DOM download flow.
TL;DR: I assumed openapi-fetch couldn't handle binary downloads, but checking the source showed it supports blobs just fine. The real hurdles were typing that masks blobs as strings and the manual DOM work to trigger downloads. On the backend, the Go export validates module filters and always returns a valid file via excelize, even when empty.
#go#excelize#openapi-fetch