Skip to main content
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 events array without invalidating or refetching the full query.
  • addComment does not use an optimistic update — the new comment event arrives via the flight:event Socket.io broadcast and is appended automatically.
  • editComment and deleteComment apply optimistic updates immediately and roll back on API error.
  • The staleTime: Infinity setting means events are never automatically re-fetched in the background.