Skip to content

Commit 612d262

Browse files
authored
chore: remove unused CONNECTION_READY event (MetaMask#33163)
## **Description** Removes unused `CONNECTION_READY` event from our code. Here are all the places in the code, including in `node_modules` that `CONNECTION_READY` appears. It is only ignored, never listened to or otherwise used. ![image](https://github.com/user-attachments/assets/abafcb71-2047-4481-8dfa-17eb721108fb) [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/33163?quickstart=1) <!-- ## **Related issues** Fixes: ## **Manual testing steps** 1. Go to this page... 2. 3. ## **Screenshots/Recordings** ### **Before** ### **After** ## **Pre-merge author checklist** - [ ] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. -->
1 parent 52db9a3 commit 612d262

File tree

3 files changed

+1
-10
lines changed

3 files changed

+1
-10
lines changed

app/scripts/lib/stream-utils.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import ObjectMultiplex from '@metamask/object-multiplex';
22
import { pipeline } from 'readable-stream';
33

4-
import { EXTENSION_MESSAGES } from '../../../shared/constants/app';
5-
64
/**
75
* Sets up stream multiplexing for the given stream
86
*
@@ -11,12 +9,6 @@ import { EXTENSION_MESSAGES } from '../../../shared/constants/app';
119
*/
1210
export function setupMultiplex(connectionStream) {
1311
const mux = new ObjectMultiplex();
14-
/**
15-
* We are using this streams to send keep alive message between backend/ui without setting up a multiplexer
16-
* We need to tell the multiplexer to ignore them, else we get the " orphaned data for stream " warnings
17-
* https://github.com/MetaMask/object-multiplex/blob/280385401de84f57ef57054d92cfeb8361ef2680/src/ObjectMultiplex.ts#L63
18-
*/
19-
mux.ignoreStream(EXTENSION_MESSAGES.CONNECTION_READY);
2012
pipeline(connectionStream, mux, connectionStream, (err) => {
2113
// For context and todos related to the error message match, see https://github.com/MetaMask/metamask-extension/issues/26337
2214
if (err && !err.message?.match('Premature close')) {

app/scripts/ui.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ async function start() {
9494

9595
/*
9696
* In case of MV3 the issue of blank screen was very frequent, it is caused by UI initialising before background is ready to send state.
97-
* Code below ensures that UI is rendered only after "CONNECTION_READY" or "startUISync"
97+
* Code below ensures that UI is rendered only after "startUISync"
9898
* messages are received thus the background is ready, and ensures that streams and
9999
* phishing warning page load only after the "startUISync" message is received.
100100
* In case the UI is already rendered, only update the streams.

shared/constants/app.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ export const SMART_TRANSACTION_CONFIRMATION_TYPES = {
8282
* Custom messages to send and be received by the extension
8383
*/
8484
export const EXTENSION_MESSAGES = {
85-
CONNECTION_READY: 'CONNECTION_READY',
8685
READY: 'METAMASK_EXTENSION_READY',
8786
} as const;
8887

0 commit comments

Comments
 (0)