-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
feat(nbstore): new doc sync engine #8918
base: canary
Are you sure you want to change the base?
Conversation
Your org has enabled the Graphite merge queue for merging into canaryAdd the label “merge” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge. Or use the label “hotfix” to add to the merge queue as a hot fix. You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link. |
waitForConnected(signal?: AbortSignal) { | ||
return new Promise<void>((resolve, reject) => { | ||
if (this.status === 'connected') { | ||
resolve(); | ||
return; | ||
} | ||
|
||
this.onStatusChanged(status => { | ||
if (status === 'connected') { | ||
resolve(); | ||
} | ||
}); | ||
|
||
signal?.addEventListener('abort', reason => { | ||
reject(reason); | ||
}); | ||
}); | ||
} |
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.
The AbortSignal
event listener should be cleaned up if the connection is already connected. Currently, if this.status === 'connected'
, the promise resolves but the abort listener is still registered. Consider returning a cleanup function from addEventListener
and calling it in the early return case:
const cleanup = signal?.addEventListener('abort', reason => {
reject(reason);
});
if (this.status === 'connected') {
cleanup?.();
resolve();
return;
}
Spotted by Graphite Reviewer
Is this helpful? React 👍 or 👎 to let us know.
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.
cleanup
☁️ Nx Cloud ReportCI is running/has finished running commands for commit 43f079e. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution ✅ Successfully ran 1 targetSent with 💌 from NxCloud. |
aa5afd5
to
ca920c9
Compare
ca920c9
to
43f079e
Compare
No description provided.