Skip to content

Commit 1f9d2c1

Browse files
committed
Merge branch 'dev' into feature/garrett
2 parents dfa8329 + b9d2639 commit 1f9d2c1

File tree

5 files changed

+29
-11
lines changed

5 files changed

+29
-11
lines changed

src/app/components/StateRoute/AxMap/Ax.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export default function AxTree(props) {
7777

7878
const [orientation, setOrientation] = useState('horizontal');
7979
const [linkType, setLinkType] = useState('diagonal');
80-
const [stepPercent, setStepPercent] = useState(0.5);
80+
const [stepPercent, setStepPercent] = useState(0.0);
8181

8282
const innerWidth: number = totalWidth - margin.left - margin.right;
8383
const innerHeight: number = totalHeight - margin.top - margin.bottom - 60;

src/app/components/StateRoute/ComponentMap/ComponentMap.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ export default function ComponentMap({
5858
currentSnapshot, // from 'tabs[currentTab].stateSnapshot object in 'MainContainer'
5959
}: LinkTypesProps): JSX.Element {
6060
const [orientation, setOrientation] = useState('vertical'); // We create a local state "orientation" and set it to a string 'vertical'.
61-
const [linkType, setLinkType] = useState('diagonal'); // We create a local state "linkType" and set it to a string 'diagonal'.
62-
const [stepPercent, setStepPercent] = useState(0.5); // We create a local state "stepPercent" and set it to a number '0.5'. This will be used to scale the Map component's link: Step to 50%
61+
const [linkType, setLinkType] = useState('step'); // We create a local state "linkType" and set it to a string 'step'.
62+
const [stepPercent, setStepPercent] = useState(0.0); // We create a local state "stepPercent" and set it to a number '0.0'. This will be used to scale the Map component's link: Step to 0%
6363
const [selectedNode, setSelectedNode] = useState('root'); // We create a local state "selectedNode" and set it to a string 'root'.
6464
const dispatch = useDispatch();
6565

@@ -82,7 +82,6 @@ export default function ComponentMap({
8282
The default view sets the root nodes location either in the left middle *or top middle of the browser window relative to the size of the browser.
8383
*/
8484

85-
8685
origin = { x: 0, y: 0 };
8786
if (orientation === 'vertical') {
8887
sizeWidth = innerWidth;
@@ -92,7 +91,7 @@ export default function ComponentMap({
9291
sizeWidth = innerHeight;
9392
sizeHeight = innerWidth;
9493
}
95-
//}
94+
//}
9695
const {
9796
tooltipData, // value/data that tooltip may need to render
9897
tooltipLeft, // number used for tooltip positioning

src/app/components/StateRoute/ComponentMap/LinkControls.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ export default function LinkControls({
7171
onChange={(e) => setLinkType(e.target.value)}
7272
style={dropDownStyle}
7373
>
74-
<option value='diagonal'>Diagonal</option>
7574
<option value='step'>Step</option>
75+
<option value='diagonal'>Diagonal</option>
7676
<option value='line'>Line</option>
7777
</select>
7878
<label> Select:</label> {/* Controls for the select selections. */}

src/extension/background.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -348,14 +348,18 @@ chrome.runtime.onConnect.addListener(async (port) => {
348348
portsArr.splice(i, 1);
349349
setTimeout(async () => {
350350
try {
351-
const response = await chrome.runtime.sendMessage({
352-
action: 'attemptReconnect',
353-
});
354-
if (response && response.success) {
351+
const newPort = chrome.runtime.connect({ name: 'reconnected' }); // Attempt to reconnect
352+
if (newPort) {
353+
portsArr.push(newPort); // Add the new port to the array
354+
newPort.onMessage.addListener((msg) => {
355+
console.log('Message received on reconnected port:', msg);
356+
});
355357
console.log('Port successfully reconnected');
358+
} else {
359+
console.warn('Failed to reconnect port');
356360
}
357361
} catch (error) {
358-
console.warn('Port reconnection failed:', error);
362+
console.warn('Port reconnection attempt failed:', error);
359363
}
360364
}, 1000);
361365
break;

src/extension/contentScript.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,21 @@
22
// in Web Metrics tab of Reactime app.
33
import { onTTFB, onLCP, onFID, onFCP, onCLS, onINP } from 'web-vitals';
44

5+
function establishConnection() {
6+
const port = chrome.runtime.connect({ name: 'content-script' }); // Reconnect
7+
port.onMessage.addListener((msg) => {
8+
console.log('Received message from background:', msg);
9+
});
10+
11+
port.onDisconnect.addListener(() => {
12+
console.warn('Port disconnected, attempting to reconnect...');
13+
setTimeout(establishConnection, 1000); // Retry after 1 second
14+
});
15+
}
16+
17+
// Initially establish connection
18+
establishConnection();
19+
520
// Reactime application starts off with this file, and will send
621
// first message to background.js for initial tabs object set up.
722
// A "tabs object" holds the information of the current tab,

0 commit comments

Comments
 (0)