Skip to content

Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.

646 B
Raw Blame
import { Component, type ReactNode } from 'react'
import { EmptyState } from './HostStateView'

/** A view that throws while rendering would unmount the whole window and leave it blank: this shows an error state with a reload instead. */
export class RenderBoundary extends Component<{ children: ReactNode }, { failed: boolean }> {
  state = { failed: false }

  static getDerivedStateFromError() {
    return { failed: true }
  }

  render() {
    if (!this.state.failed) return this.props.children
    return <EmptyState icon="exclamationmark.triangle.fill" title="Something went wrong" action={['Try again', () => location.reload()]} />
  }
}