Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-whitaker committed Dec 12, 2024
1 parent 2e22452 commit 8626c07
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion packages/app/src/component/data-grid/add-row.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ type PropsWithOnClick = {
export default function AddRow <T extends { name: string }>({ onClick, data }: PropsWithOnClick & { data: T[] }) {
const [selection, setSelection] = useState<string|null>(null);
const _onClick = useCallback(() => {
console.log("this is getting called when adding");
if (onClick && selection) onClick(selection);
}, [onClick, selection]);

Expand All @@ -20,8 +21,12 @@ export default function AddRow <T extends { name: string }>({ onClick, data }: P
<DataGridLabel className="ml-6">
<DataGridSelect
allowNull
value={selection}
data={data.map((({ name }) => ({ value: name, name })))}
onChange={setSelection}
onChange={(value) => {
console.log("this is triggered", value);
setSelection(value);
}}
/>
</DataGridLabel>
</DataGridRow>
Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/component/data-grid/select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {PropsWithClass, PropsWithOnChange} from "../../../../core";

export type DataGridSelectProps = PropsWithOnChange<string> & PropsWithClass & {
data: InputSelectOption[];
value?: string;
value?: string|null;
allowNull?: boolean;
}
export default function DataGridSelect({ className, data, value, onChange, allowNull = false }: DataGridSelectProps) {
Expand Down

0 comments on commit 8626c07

Please sign in to comment.