Prechádzať zdrojové kódy

[Bug]: Prevent selection of "add more repo" option in dropdown (#5688)

Rohit Malhotra 1 rok pred
rodič
commit
3876f4a59c

+ 4 - 0
frontend/src/components/features/github/github-repo-selector.tsx

@@ -1,3 +1,4 @@
+import React from "react";
 import { Autocomplete, AutocompleteItem } from "@nextui-org/react";
 import { useDispatch } from "react-redux";
 import posthog from "posthog-js";
@@ -14,6 +15,7 @@ export function GitHubRepositorySelector({
   repositories,
 }: GitHubRepositorySelectorProps) {
   const { data: config } = useConfig();
+  const [selectedKey, setSelectedKey] = React.useState<string | null>(null);
 
   // Add option to install app onto more repos
   const finalRepositories =
@@ -36,6 +38,7 @@ export function GitHubRepositorySelector({
       dispatch(setSelectedRepository(repo.full_name));
       posthog.capture("repository_selected");
       onSelect();
+      setSelectedKey(id);
     }
   };
 
@@ -63,6 +66,7 @@ export function GitHubRepositorySelector({
       name="repo"
       aria-label="GitHub Repository"
       placeholder="Select a GitHub project"
+      selectedKey={selectedKey}
       inputProps={{
         classNames: {
           inputWrapper: