"use client";

import type { ComponentProps } from "react";

type AutoSubmitSelectProps = ComponentProps<"select">;

export function AutoSubmitSelect({
  onChange,
  ...props
}: AutoSubmitSelectProps) {
  return (
    <select
      {...props}
      onChange={(event) => {
        onChange?.(event);
        event.currentTarget.form?.requestSubmit();
      }}
    />
  );
}
