Skip to content

Commit

Permalink
Resolve merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Matsuuu committed Aug 5, 2021
2 parents b716ae5 + 8188304 commit 9e2938e
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 16 deletions.
5 changes: 3 additions & 2 deletions lib/background/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,10 @@ function tabUpdateListener(tabId, changeInfo, tab) {
// the connections are hanging, causing the devtools to hang.
if (nydus && Object.keys(nydus.connections).length > 0 && !nydus.ready) {
console.warn("[WebComponentDevTools]: Rebuilding connection pool Nydus");
createNydus();
nydus._reConnectDisconnected();
//createNydus();
}
}, 5000);
}, 15000);
}
}

Expand Down
4 changes: 3 additions & 1 deletion lib/elements/custom-elements-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,9 @@ class CustomElementList extends LitElement {
const target = /** @type {any} */ (Array.from(
this.shadowRoot.querySelectorAll('custom-elements-list-item'),
)[index]);
target.scrollToElement();
if (target) {
target.scrollToElement();
}
}

_onWordFilterInput(e) {
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "Web Component DevTools",
"version": "0.1.7",
"version": "0.1.8",
"minimum_chrome_version": "10.0",
"description": "Developer tooling for Web Components and Web Component Libraries",
"author": "Matsuuu <[email protected]>",
Expand Down
32 changes: 20 additions & 12 deletions packages/nydus/nydus.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,21 @@ export class Nydus {
});
}

async _reConnectDisconnected() {
await this._determineTabIds();
const connectionsFlat = this._getConnectionsFlat();
this.connectionOptions.forEach(connectionOpts => {
if (!connectionsFlat.find(con => con.id === connectionOpts.id).ready) {
this.addConnection(
connectionOpts.id,
!connectionOpts.host,
connectionOpts.onMessage,
connectionOpts.isBackground,
);
}
});
}

/**
*
* Communication is important to keep tab-specific so that if the user has
Expand Down Expand Up @@ -213,7 +228,7 @@ export class Nydus {
async message(recipient, message, _retryCount = 0) {
await this.whenReady;

const tabId = message.tabId ?? await this._tryGetCurrentTab();
const tabId = message.tabId ?? (await this._tryGetCurrentTab());
let connPool = this.connections[tabId] ?? this.connections[-1];
if (!connPool) {
if (_retryCount >= 5) {
Expand Down Expand Up @@ -498,18 +513,11 @@ export class Nydus {
_requirementsFulfilled() {
// Check that all required connections are built and ready
const connectionsFlat = this._getConnectionsFlat();
return (
connectionsFlat.length === this.connectionOptions.length &&
connectionsFlat.every(conn => conn.ready) &&
this._allConnectionsAreCreated(connectionsFlat)
);
}

_allConnectionsAreCreated(connectionsFlat) {
const connMap = {};
connectionsFlat.forEach(conn => (connMap[conn.id] = conn));
return this.connectionOptions.every(connOpt => {
return connMap[connOpt.id] != null;
const hasOneOfEachRequiredConnection = this.connectionOptions.every(opt => {
const connectionsToOpt = connectionsFlat.filter(con => con.id === opt.id);
return connectionsToOpt.some(con => con.ready);
});
return hasOneOfEachRequiredConnection;
}
}

0 comments on commit 9e2938e

Please sign in to comment.