@@ -24,7 +24,6 @@ import {
2424 T3_PROJECT_FILE_NAME ,
2525 ThreadId ,
2626} from "@t3tools/contracts" ;
27- import { sanitizeNewRefName } from "@t3tools/shared/git" ;
2827import { threadContextsOutsideEnvironment } from "@t3tools/shared/composerContextReferences" ;
2928import { resolveNewThreadEnvMode , resolveProjectSettings } from "@t3tools/shared/projectSettings" ;
3029import { parseT3ProjectFile } from "@t3tools/shared/t3ProjectFile" ;
@@ -80,7 +79,7 @@ import {
8079 rememberModelOptions ,
8180 withRememberedModelOptions ,
8281} from "../../state/use-model-option-memory" ;
83- import { useBranches , useDebouncedValue , usePaginatedBranches } from "../../state/queries" ;
82+ import { useBranches , usePaginatedBranches } from "../../state/queries" ;
8483import { vcsEnvironment } from "../../state/vcs" ;
8584import {
8685 flattenQueuedThreadMessages ,
@@ -117,7 +116,6 @@ import {
117116} from "../../state/legacy-plan-mode" ;
118117import { useLegacyPlanModeState } from "./use-legacy-plan-mode-enabled" ;
119118import {
120- filterNewTaskBranches ,
121119 resolveNewTaskBranchWorktreePath ,
122120 resolveNewTaskLocalWorkspaceSelection ,
123121 resolveNewTaskWorkspaceSelection ,
@@ -128,8 +126,6 @@ import { useOlderSettledCount } from "../../state/olderSettledShelf";
128126
129127type WorkspaceMode = "local" | "worktree" ;
130128
131- const BRANCH_SEARCH_DEBOUNCE_MS = 150 ;
132-
133129function pendingTaskDraftKey ( messageId : string ) : string {
134130 return `pending-task:${ messageId } ` ;
135131}
@@ -182,11 +178,7 @@ type NewTaskFlowContextValue = {
182178 readonly prompt : string ;
183179 readonly attachments : ReadonlyArray < DraftComposerAttachment > ;
184180 readonly submitting : boolean ;
185- readonly branchQuery : string ;
186181 readonly branchesLoading : boolean ;
187- readonly branchesError : string | null ;
188- readonly branchesFetchingNextPage : boolean ;
189- readonly hasMoreBranches : boolean ;
190182 readonly availableBranches : ReadonlyArray < VcsRef > ;
191183 readonly currentCheckoutBranchName : string | null ;
192184 readonly runtimeMode : RuntimeMode ;
@@ -204,7 +196,6 @@ type NewTaskFlowContextValue = {
204196 readonly selectedModelOption : ModelOption | null ;
205197 readonly selectedProviderStatus : ServerProvider | null ;
206198 readonly providerGroups : ReadonlyArray < ProviderGroup > ;
207- readonly filteredBranches : ReadonlyArray < VcsRef > ;
208199 readonly reset : ( ) => void ;
209200 readonly setProject : ( project : EnvironmentProject ) => void ;
210201 /** Returns false if the existing draft is gone, allowing fallback to a fresh draft. */
@@ -238,9 +229,7 @@ type NewTaskFlowContextValue = {
238229 readonly removeAttachment : ( imageId : string ) => void ;
239230 readonly clearAttachments : ( ) => void ;
240231 readonly setSubmitting : ( value : boolean ) => void ;
241- readonly setBranchQuery : ( value : string ) => void ;
242232 readonly loadBranches : ( ) => void ;
243- readonly loadMoreBranches : ( ) => void ;
244233 readonly setRuntimeMode : ( value : RuntimeMode ) => void ;
245234 readonly setInteractionMode : ( value : ProviderInteractionMode ) => void ;
246235 readonly setSelectedModelOptions : (
@@ -287,7 +276,6 @@ export function NewTaskFlowProvider(
287276 const [ selectedProjectKey , setSelectedProjectKey ] = useState < string | null > ( null ) ;
288277 const [ activeDraftKey , setActiveDraftKey ] = useState < string | null > ( null ) ;
289278 const [ submitting , setSubmitting ] = useState ( false ) ;
290- const [ branchQuery , setBranchQuery ] = useState ( "" ) ;
291279 const [ expandedProvider , setExpandedProvider ] = useState < string | null > ( null ) ;
292280 const [ editingPendingTask , setEditingPendingTask ] = useState < QueuedThreadMessage | null > ( null ) ;
293281 const pendingLocalBranchSyncDraftKeysRef = useRef ( new Set < string > ( ) ) ;
@@ -300,7 +288,6 @@ export function NewTaskFlowProvider(
300288 setSelectedProjectKey ( null ) ;
301289 setActiveDraftKey ( null ) ;
302290 setSubmitting ( false ) ;
303- setBranchQuery ( "" ) ;
304291 setExpandedProvider ( null ) ;
305292 pendingLocalBranchSyncDraftKeysRef . current . clear ( ) ;
306293 const editing = editingPendingTaskRef . current ;
@@ -684,28 +671,17 @@ export function NewTaskFlowProvider(
684671 }
685672 replaceComposerDraftAttachments ( selectedProjectDraftKey , [ ] ) ;
686673 } ;
687- const branchSearchQuery = sanitizeNewRefName ( branchQuery ) ;
688- const debouncedBranchQuery = useDebouncedValue ( branchSearchQuery , BRANCH_SEARCH_DEBOUNCE_MS ) ;
689- const branchTarget = {
674+ const branchState = usePaginatedBranches ( {
690675 environmentId : selectedProject ?. environmentId ?? null ,
691676 cwd : selectedProject ?. workspaceRoot || null ,
692- query : debouncedBranchQuery ,
693- } ;
694- const branchState = usePaginatedBranches ( branchTarget ) ;
695- const branchSearchIsDebouncing = branchSearchQuery !== debouncedBranchQuery ;
696- const branchesLoading =
697- branchSearchIsDebouncing || ( branchState . isPending && branchState . data === null ) ;
698- const branchesFetchingNextPage = branchState . isFetchingNextPage ;
699- const hasMoreBranches =
700- branchState . data ?. nextCursor !== null && branchState . data ?. nextCursor !== undefined ;
677+ } ) ;
678+ const branchesLoading = branchState . isPending && branchState . data === null ;
701679 const allBranchRefs = branchState . refs ;
702680 const availableBranches = pipe (
703681 allBranchRefs ,
704682 Arr . filter ( ( branch ) => ! branch . isRemote ) ,
705683 ) ;
706684
707- const filteredBranches = filterNewTaskBranches ( allBranchRefs , branchQuery ) ;
708-
709685 const carryDraftContentTo = ( project : EnvironmentProject ) => {
710686 const target = { environmentId : project . environmentId , projectId : project . id } ;
711687 if ( activeDraftKey !== null && isNewTaskDraftKey ( activeDraftKey ) ) {
@@ -884,7 +860,6 @@ export function NewTaskFlowProvider(
884860 } ;
885861
886862 const refreshBranches = branchState . refresh ;
887- const loadMoreBranches = branchState . loadNext ;
888863 const loadBranches = ( ) => {
889864 if ( ! selectedProject ) {
890865 return ;
@@ -1163,11 +1138,7 @@ export function NewTaskFlowProvider(
11631138 prompt,
11641139 attachments,
11651140 submitting,
1166- branchQuery,
11671141 branchesLoading,
1168- branchesError : branchState . error ,
1169- branchesFetchingNextPage,
1170- hasMoreBranches,
11711142 availableBranches,
11721143 currentCheckoutBranchName,
11731144 runtimeMode,
@@ -1182,7 +1153,6 @@ export function NewTaskFlowProvider(
11821153 selectedModelOption,
11831154 selectedProviderStatus,
11841155 providerGroups,
1185- filteredBranches,
11861156 reset,
11871157 setProject,
11881158 openDraft,
@@ -1203,9 +1173,7 @@ export function NewTaskFlowProvider(
12031173 removeAttachment,
12041174 clearAttachments,
12051175 setSubmitting,
1206- setBranchQuery,
12071176 loadBranches,
1208- loadMoreBranches,
12091177 setRuntimeMode,
12101178 setInteractionMode,
12111179 setSelectedModelOptions,
0 commit comments