-
Notifications
You must be signed in to change notification settings - Fork 191
fix: prevent duplicate repository connection notifications #2474
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
base: main
Are you sure you want to change the base?
fix: prevent duplicate repository connection notifications #2474
Conversation
- Add isConnecting flag to prevent race condition - Disable submit button during connection process - Ensure notification appears only once - Use finally block for proper cleanup Fixes appwrite#2472
WalkthroughThe change modifies src/lib/components/git/connectRepoModal.svelte so that selecting a repository in the Repositories component no longer automatically calls Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ 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 |
if (isConnecting) return; | ||
isConnecting = true; |
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.
This is great approach for solving a lot of UX issues 💯
I would fully agree with his, if it was user clicking button twice, causing this.
Problem is, here it seems to be hapening automatically - you click once, but this function seems to be called twice. Internally, something is going on, causing this issue.
Let's please debug a bit further, to find the root cause. I think knowing that, we will find nicer solution at the source, instead of preventing the outcome with a patch
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.
Thanks for the review, Sir! 🙏
You were right, the function was being called twice because connectRepo()
was triggered both on repository selection and the modal’s onSubmit
. I’ve removed the extra call so now it runs only once via onSubmit
.
Updated the PR, please have a look when you get a chance.
- Add isConnecting flag to prevent race condition - Disable submit button during connection process - Ensure notification appears only once - Use finally block for proper cleanup Fixes appwrite#2472
d3e163d
to
6f1cadd
Compare
What does this PR do?
Problem
The
connectRepo()
function was being called twice:onSubmit
This caused the success notification to appear twice, leading to a confusing UX.
Solution
Removed the extra
connectRepo()
call in the repository selection handler. Now, the modal’sonSubmit
handles everything, so the function runs only once.This is a minimal and clean fix addressing the root cause instead of patching the symptom.
Changes Made
connectRepo()
call in the repository selection callbackonSubmit
as the single source of truthTest Plan
Local Testing Performed:
pnpm lint
andpnpm format
- all checks passedScreenshots
Before Fix:

After Fix:

Related PRs and Issues
Fixes #2472
Have you read the Contributing Guidelines on issues?
Yes, I have read and followed the contributing guidelines.
Summary by CodeRabbit
Bug Fixes
Refactor