Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 7, 2026

The "Change template" button was shown even with 0 or 1 PR templates. Clicking it with a single template displayed a useless single-option picker.

Changes

  • Added PullRequestTemplateCount GraphQL query to fetch template count without full content
  • Added templateCount field to CreateParamsNew interface
  • Implemented count fetching in githubRepository.ts and folderRepositoryManager.ts (checks both local repo and .github org repo)
  • Fetch template count in parallel with other PR overview data in getCreateParams()
  • Updated button visibility condition from usingTemplate to usingTemplate && templateCount > 1
// Before
{ctx.createParams.usingTemplate ?
  <a onClick={() => changeTemplate()}>{notebookTemplate}</a> : null}

// After  
{ctx.createParams.usingTemplate && (ctx.createParams.templateCount ?? 0) > 1 ?
  <a onClick={() => changeTemplate()}>{notebookTemplate}</a> : null}

Button now hidden with 0-1 templates, visible with 2+.

Original prompt

This section details on the original issue you should resolve

<issue_title>Change template button should hide when there is <=1 template</issue_title>
<issue_description>Testing #8337

When there's only 1 template available and you press Change template, you get notified of Only one template is available, and nothing happens. I kind of expected the one template to override the text field, but the real issue here is that the button exists in this scenario at all.

When none exist, there's a notification with "No pull request templates found".

The button just shouldn't appear when there's 0 or 1 templates available</issue_description>

<agent_instructions>Add a new query to the shared queries that just gets the PR template count. Call this when all the other PR overview data is fetched. Hide the "change template" button when appropriate. </agent_instructions>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits January 7, 2026 09:25
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
…plate

Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Copilot AI changed the title [WIP] Hide change template button when templates are insufficient Hide Change Template button when ≤1 template available Jan 7, 2026
Copilot AI requested a review from alexr00 January 7, 2026 09:34
@alexr00 alexr00 closed this Jan 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Change template button should hide when there is <=1 template

2 participants