Pending UI

Horn exposes pending state through two mechanisms.

loading.*

app/pages/**/loading.* renders while a client-side navigation is pending.

  • it does not render during the initial SSR request
  • the nearest matched loading boundary wins
  • layout loading keeps the layout shell and swaps the child subtree
  • page loading swaps only the page node

Loading components receive:

  • routeId
  • location
  • previousLocation
  • action

useNavigation()

Use useNavigation() when you need state outside a loading boundary.

const navigation = useNavigation()

It exposes:

  • state
  • location
  • previousLocation
  • action
  • isLoading
  • isSubmitting
  • isNavigating