@@ -3,6 +3,7 @@ import type {
33 EnvironmentId ,
44 PullRequestRef ,
55 PullRequestReviewerCandidate ,
6+ SourceControlProviderKind ,
67} from "@t3tools/contracts" ;
78import { mergeReviewerCandidates } from "@t3tools/client-runtime/pull-request-reviewers" ;
89import { CheckIcon , UserPlusIcon } from "lucide-react" ;
@@ -22,10 +23,12 @@ export function PullRequestReviewerPicker({
2223 environmentId,
2324 reference,
2425 allowed,
26+ provider,
2527} : {
2628 environmentId : EnvironmentId ;
2729 reference : PullRequestRef ;
2830 allowed : boolean ;
31+ provider : SourceControlProviderKind ;
2932} ) {
3033 const [ open , setOpen ] = useState ( false ) ;
3134 const [ query , setQuery ] = useState ( "" ) ;
@@ -36,7 +39,9 @@ export function PullRequestReviewerPicker({
3639 ) ;
3740 // Past the first page the host is asked, since what was loaded cannot answer for the rest.
3841 const searchQuery = useDebouncedValue ( query . trim ( ) , 250 ) ;
39- const searchesHost = candidatesQuery . data ?. truncated === true && searchQuery . length > 0 ;
42+ const supportsSearch = provider === "github" || provider === "gitlab" ;
43+ const searchesHost =
44+ supportsSearch && candidatesQuery . data ?. truncated === true && searchQuery . length > 0 ;
4045 // Only once the debounce has caught up, or rows matching the previous text would linger.
4146 const searched = searchesHost && searchQuery === query . trim ( ) ;
4247 const searchResult = useEnvironmentQuery (
@@ -108,6 +113,7 @@ export function PullRequestReviewerPicker({
108113 ( candidatesQuery . isPending && candidatesQuery . data === null ) ||
109114 // Nothing loaded matches yet, and the host has not answered: not a "nobody matches".
110115 ( candidates . length === 0 &&
116+ supportsSearch &&
111117 candidatesQuery . data ?. truncated === true &&
112118 query . trim ( ) . length > 0 &&
113119 ( searchQuery !== query . trim ( ) || searchResult . isPending ) )
@@ -125,15 +131,18 @@ export function PullRequestReviewerPicker({
125131 errorLabel = "The people with access could not be read."
126132 truncated = {
127133 candidatesQuery . data ?. truncated === true &&
128- ( query . trim ( ) . length === 0 ||
134+ ( ! supportsSearch ||
135+ query . trim ( ) . length === 0 ||
129136 ( searched && ( searchResult . error !== null || searchResult . data ?. truncated === true ) ) )
130137 }
131138 truncatedLabel = {
132- searched && searchResult . error !== null
133- ? `Only the people already listed are matched: the host search failed. ${ searchResult . error } `
134- : searched
135- ? "More people match than the host returned. Keep typing to narrow it down."
136- : "This repository has more people with access than are listed here. Search to find them."
139+ ! supportsSearch
140+ ? "The provider has more reviewers than are listed here. Find additional reviewers on the provider."
141+ : searched && searchResult . error !== null
142+ ? `Only the people already listed are matched: the host search failed. ${ searchResult . error } `
143+ : searched
144+ ? "More people match than the host returned. Keep typing to narrow it down."
145+ : "This repository has more people with access than are listed here. Search to find them."
137146 }
138147 candidateKey = { ( candidate ) => `${ candidate . kind } :${ candidate . id } ` }
139148 disabled = { pending !== null }
0 commit comments