useFlightEvents provides access to the live flight event log. It hydrates from GET /api/flight-events on mount, then subscribes to flight:event Socket.io events to append new events as they arrive. Comment mutations (add, edit, delete) use optimistic updates.
Import
Signature
Parameters
Return value
FlightLogEvent
See FlightLogEvent for the full shape.
EventCategory enum
See EventCategory for all values.
Usage
Filtering by category
Editing and deleting comments
Notes
- New events arriving via Socket.io are appended to the end of the
eventsarray without invalidating or refetching the full query. addCommentdoes not use an optimistic update — the new comment event arrives via theflight:eventSocket.io broadcast and is appended automatically.editCommentanddeleteCommentapply optimistic updates immediately and roll back on API error.- The
staleTime: Infinitysetting means events are never automatically re-fetched in the background.