fix branch query

This commit is contained in:
Saxon Fletcher committed 2025-07-04 09:14:39 +10:00
1 parent 59b132105d
commit 48ce60553f
3 files changed
+10 -6

No files matched your search

@@ -17,7 +17,7 @@ export function useBranchCommands() {
let { data: branches } = useBranchesQuery(
{
projectRef: selectedProject?.parentRef,
projectRef: selectedProject?.parent_project_ref || selectedProject?.ref,
},
{ enabled: isBranchingEnabled }
)
@@ -108,7 +108,7 @@ const SidePanelGitHubRepoLinker = ({ projectRef }: SidePanelGitHubRepoLinkerProp
)
const { data: existingBranches } = useBranchesQuery(
{ projectRef: selectedProject?.ref },
{ projectRef: selectedProject?.parent_project_ref || selectedProject?.ref },
{ enabled: !!selectedProject?.ref }
)
@@ -80,10 +80,14 @@ export const BranchDropdown = () => {
const projectDetails = useSelectedProject()
const snap = useAppStateSnapshot()
const isBranch = projectDetails?.parent_project_ref !== undefined
const projectRef =
projectDetails !== undefined ? (isBranch ? projectDetails.parent_project_ref : ref) : undefined
const { data: branches, isLoading, isError, isSuccess } = useBranchesQuery({ projectRef })
const projectRef = projectDetails?.parent_project_ref || ref
const {
data: branches,
isLoading,
isError,
isSuccess,
} = useBranchesQuery({ projectRef }, { enabled: Boolean(projectDetails) })
const isBranchingEnabled = projectDetails?.is_branch_enabled === true
const selectedBranch = branches?.find((branch) => branch.project_ref === ref)