Home / Function/ BooleanEditor() — supabase Function Reference

BooleanEditor() — supabase Function Reference

Architecture documentation for the BooleanEditor() function in BooleanEditor.tsx from the supabase codebase.

Entity Profile

Relationship Graph

Source Code

apps/studio/components/grid/components/editor/BooleanEditor.tsx lines 8–43

export const BooleanEditor = <TRow, TSummaryRow = unknown>({
  row,
  column,
  isNullable,
  onRowChange,
  onClose,
}: Props<TRow, TSummaryRow>) => {
  const value = row[column.key as keyof TRow] as unknown as string

  const onBlur = () => onClose(false)
  const onChange = (event: any) => {
    const value = event.target.value
    if (value === 'null') {
      onRowChange({ ...row, [column.key]: null }, true)
    } else {
      onRowChange({ ...row, [column.key]: value === 'true' }, true)
    }
  }

  return (
    <Select
      autoFocus
      id="boolean-editor"
      name="boolean-editor"
      size="small"
      onBlur={onBlur}
      onChange={onChange}
      defaultValue={value === null || value === undefined ? 'null' : value.toString()}
      style={{ width: `${column.width}px` }}
    >
      <Select.Option value="true">TRUE</Select.Option>
      <Select.Option value="false">FALSE</Select.Option>
      {isNullable && <Select.Option value="null">NULL</Select.Option>}
    </Select>
  )
}

Subdomains

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free