Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/dashboard/components/array-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type Props = {
setSelected: (v: string[]) => void;
};

export const ArrayInput: React.FC<Props> = ({ title, placeholder, selected, setSelected }) => {
export const ArrayInput: React.FC<Props> = ({ title, placeholder, selected = [], setSelected }) => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Consider making the selected prop optional in the Props type.

While adding a default value for selected fixes the "undefined is not iterable" error, there's a slight inconsistency in the type definition. The selected prop is marked as required in the Props type but has a default value in the component signature.

Consider updating the Props type to match the runtime behavior:

type Props = {
  title?: string;
  placeholder?: string;
-  selected: string[];
+  selected?: string[];
  setSelected: (v: string[]) => void;
};
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export const ArrayInput: React.FC<Props> = ({ title, placeholder, selected = [], setSelected }) => {
type Props = {
title?: string;
placeholder?: string;
selected?: string[];
setSelected: (v: string[]) => void;
};

const inputRef = React.useRef<HTMLInputElement>(null);
const [inputValue, setInputValue] = React.useState("");

Expand Down