- Notifications
You must be signed in to change notification settings - Fork5.4k
Update lattice.ts#38415
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 ourterms of service andprivacy 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?
Update lattice.ts#38415
Conversation
CLA Signature Action: Thank you for your submission, we really appreciate it. We ask that you read and sign ourContributor License Agreement before we can accept your contribution. You can sign the CLA by just by adding a comment to this pull request with this exact sentence:
By commenting with the above message you are agreeing to the terms of the CLA. Your account will be recorded as agreeing to our CLA so you don't need to sign it again for future contributions to this repository. 0 out of1 committers have signed the CLA. |
| window.addEventListener('message',onMessageListener,false); | ||
| }) | ||
| .catch((error)=>{ | ||
| // Handle tab opening failure (e.g., pop-up |
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.
Bug: Missing return true breaks async sendResponse in Chrome
The Chrome extension message listener is missingreturn true; after the promise chain. When usingsendResponse asynchronously (inside.then() or.catch() callbacks), the listener must returntrue synchronously to keep the message channel open. Without it, Chrome closes the channel immediately after the listener returnsundefined, causing allsendResponse calls to silently fail. Other offscreen handlers in this codebase (likeledger.ts andtrezor.ts) correctly includereturn true; with explanatory comments referencing the Chrome API docs. Additionally, the file appears to be truncated mid-catch block, leaving the code syntactically incomplete.
Uh oh!
There was an error while loading.Please reload this page.
Note
Refactors the offscreen Lattice flow to open the connector tab, validate/parse credentials, detect tab closure, and consistently return results/errors with cleanup.
app/offscreen/lattice.ts):openConnectorTab(url: string): Promise<Window>with improved error messaging.init()to filter byOffscreenCommunicationTarget.latticeOffscreen, open the tab, and orchestrate response forwarding.postMessageorigin/source/data againstKnownOrigins.latticeand the opened tab.deviceID,password).sendResponse.Written byCursor Bugbot for commitddcb627. This will update automatically on new commits. Configurehere.