Skip to content

Conversation

avallete
Copy link
Member

@avallete avallete commented Sep 25, 2025

What kind of change does this PR introduce?

  • Automatically trigger refetch of available repos after authorization/install github pop-up is closed introduction a delay of 2 seconds before refetch allowing the new authorized repositories to be updated before refetch.
  • Fix some types/linting errors

Copy link

vercel bot commented Sep 25, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
design-system Ready Ready Preview Comment Sep 27, 2025 4:59am
docs Ready Ready Preview Comment Sep 27, 2025 4:59am
studio-self-hosted Ready Ready Preview Comment Sep 27, 2025 4:59am
studio-staging Ready Ready Preview Comment Sep 27, 2025 4:59am
ui-library Ready Ready Preview Comment Sep 27, 2025 4:59am
zone-www-dot-com Ready Ready Preview Comment Sep 27, 2025 4:59am
2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
cms Ignored Ignored Sep 27, 2025 4:59am
studio Ignored Ignored Sep 27, 2025 4:59am

Copy link

supabase bot commented Sep 25, 2025

This pull request has been ignored for the connected project xguihxuzqibwxjnimxev because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

Copy link
Contributor

github-actions bot commented Sep 25, 2025

Studio E2E Results

  • Total: 1
  • Passed: 1
  • Failed: 0
  • Skipped: 0
  • Timed out: 0
  • Interrupted: 0
  • Flaky: 0
  • Duration: 2.6s

Artifacts: https://github.com/supabase/supabase/actions/runs/18055278634

Last updated: Saturday 27, September, 2025 05:07:42 (UTC)

@avallete avallete changed the title Fix/refetch GitHub repositories after new install fix(studio): refetch GitHub repositories after new install Sep 26, 2025

const GITHUB_ICON = (
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 98 96" className="w-6">
<title>GitHub icon</title>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note

Svg must have a title in it (biome says)

Comment on lines +96 to +101
const refetchGitHubAuthorizationAndRepositories = () => {
setTimeout(() => {
refetchGitHubAuthorization()
refetchGitHubRepositories()
}, 2000) // 2 second to delay to let github authorization and repositories to be updated
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note:

Github api takes ~2s per testing to acknowledge changes, retrying the query after 2s allows the pop-up to update with the latest repositories without the need to interact / search over the pop-up.

const [isConfirmingRepoChange, setIsConfirmingRepoChange] = useState(false)
const [repoComboBoxOpen, setRepoComboboxOpen] = useState(false)
const isParentProject = !Boolean(selectedProject?.parent_project_ref)
const isParentProject = !selectedProject?.parent_project_ref
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note:

Unnecessary boolean.

branchName: val.branchName,
})
} catch (error) {
} catch {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note:

Unused error

if (error) handleError(error)
// [Alaister]: temp fix until we have a proper response type
return (data as any).repositories
return data.repositories
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note

This is now properly typed.

Comment on lines +66 to +79
if (closeCallback) {
// Poll to check if window is closed
const checkClosed = setInterval(() => {
if (newWindow.closed) {
clearInterval(checkClosed)
closeCallback()
}
}, 500) // Check every 500ms

// Add a timeout to prevent infinite polling
setTimeout(() => {
clearInterval(checkClosed)
}, 300000) // 5 minutes timeout
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note

This trick allow to trigger refetch when the pop-up is closed after installation.

@avallete avallete marked this pull request as ready for review September 26, 2025 09:52
@avallete avallete requested a review from a team as a code owner September 26, 2025 09:52
Copy link
Contributor

@charislam charislam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested on preview

@avallete avallete enabled auto-merge (squash) September 27, 2025 04:53
@coveralls
Copy link

Coverage Status

coverage: 67.221% (-0.2%) from 67.459%
when pulling 75e3f7e on fix/refetch-github-repositories-after-new-install
into 9cfa6e8 on master.

@avallete avallete merged commit e8c37cc into master Sep 27, 2025
20 checks passed
@avallete avallete deleted the fix/refetch-github-repositories-after-new-install branch September 27, 2025 04:59
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.

3 participants