-
Notifications
You must be signed in to change notification settings - Fork 212
Improve UX for repositories modal #2809
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Console (appwrite/console)Project ID: Tip Global CDN and DDoS protection come free with every Sites deployment |
WalkthroughThis PR changes repository-list UI and two creation pages. In the repositories component it adds internal UI state ( Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/lib/components/git/repositories.svelte (1)
121-137: Prevent stale requests from clearing the loading state early.The stale-response guard prevents old data writes, but
isLoadingRepositoriesis still flipped tofalseby earlier requests in the callers. That can hide loading while a newer request is still in flight. Consider tying loading-state updates to the samerequestId.🛠️ Suggested fix to tie loading state to the latest request
- const debouncedLoadRepositories = debounce( - async (installationId: string, searchTerm: string) => { - isLoadingRepositories = true; - try { - await loadRepositories(installationId, searchTerm); - } finally { - isLoadingRepositories = false; - } - }, - 300 - ); + const debouncedLoadRepositories = debounce( + async (installationId: string, searchTerm: string) => { + await loadRepositories(installationId, searchTerm); + }, + 300 + ); - const loadRepositoryPage = async () => { - isLoadingRepositories = true; - try { - await loadRepositories(selectedInstallation, search); - } finally { - isLoadingRepositories = false; - } - }; + const loadRepositoryPage = async () => { + await loadRepositories(selectedInstallation, search); + }; async function loadRepositories(installationId: string, search: string) { const requestId = ++loadRepositoriesRequestId; + isLoadingRepositories = true; - const result = await sdk - .forProject(page.params.region, page.params.project) - .vcs.listRepositories({ - installationId, - type: - product === 'functions' ? VCSDetectionType.Runtime : VCSDetectionType.Framework, - search: search || undefined, - queries: [Query.limit(limit), Query.offset(offset)] - }); - - // Stale request - if (requestId !== loadRepositoriesRequestId) { - return; - } - - $repositories.repositories = - product === 'functions' - ? (result as unknown as Models.ProviderRepositoryRuntimeList) - .runtimeProviderRepositories - : (result as unknown as Models.ProviderRepositoryFrameworkList) - .frameworkProviderRepositories; //TODO: remove forced cast after backend fixes - $repositories.total = result.total; - $repositories.search = search; - $repositories.installationId = installationId; - return $repositories.repositories; + try { + const result = await sdk + .forProject(page.params.region, page.params.project) + .vcs.listRepositories({ + installationId, + type: + product === 'functions' + ? VCSDetectionType.Runtime + : VCSDetectionType.Framework, + search: search || undefined, + queries: [Query.limit(limit), Query.offset(offset)] + }); + + // Stale request + if (requestId !== loadRepositoriesRequestId) { + return; + } + + $repositories.repositories = + product === 'functions' + ? (result as unknown as Models.ProviderRepositoryRuntimeList) + .runtimeProviderRepositories + : (result as unknown as Models.ProviderRepositoryFrameworkList) + .frameworkProviderRepositories; //TODO: remove forced cast after backend fixes + $repositories.total = result.total; + $repositories.search = search; + $repositories.installationId = installationId; + return $repositories.repositories; + } finally { + if (requestId === loadRepositoriesRequestId) { + isLoadingRepositories = false; + } + } }
🤖 Fix all issues with AI agents
In `@src/lib/components/git/repositories.svelte`:
- Around line 276-280: The click handler sets connectingRepositoryId (used to
disable buttons) but never clears it, so failures block all buttons; update the
connect function to return a Promise and ensure connectingRepositoryId is reset
in a finally block (e.g., inside connect or in the caller) so it is cleared
whether connect succeeds or throws; update all callers of connect to
return/await that Promise so the finally runs and the disabled state (tied to
connectingRepositoryId) is released.
src/routes/(console)/project-[region]-[project]/functions/create-function/+page.svelte
Outdated
Show resolved
Hide resolved
src/routes/(console)/project-[region]-[project]/functions/create-function/+page.svelte
Outdated
Show resolved
Hide resolved
src/routes/(console)/project-[region]-[project]/functions/create-function/+page.svelte
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In
`@src/routes/`(console)/project-[region]-[project]/functions/create-function/+page.svelte:
- Around line 52-64: The connect function can throw when $installation is
null/undefined because it directly accesses $installation.$id; add a guard at
the start of connect (function connect) to verify $installation exists (and
optionally $installation.$id) and either return early or handle the missing
installation (e.g., show error/redirect) before calling repository.set,
resolveRoute, or goto; ensure the constructed URL only uses $installation.$id
when it is defined to prevent a TypeError.

Resolves SER-642
Various improvements to repositories UX
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.