Skip to content

Commit 38adde2

Browse files
committed
feat: add meticulous recorder
1 parent c6b7588 commit 38adde2

File tree

3 files changed

+33
-1
lines changed

3 files changed

+33
-1
lines changed

site/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"deadcode": "ts-prune | grep -v \".stories\\|.config\\|e2e\\|__mocks__\\|used in module\\|testHelpers\\|typesGenerated\" || echo \"No deadcode found.\""
3131
},
3232
"dependencies": {
33+
"@alwaysmeticulous/recorder-loader": "2.137.0",
3334
"@emoji-mart/data": "1.2.1",
3435
"@emoji-mart/react": "1.1.1",
3536
"@emotion/css": "11.11.2",

site/pnpm-lock.yaml

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

site/src/index.tsx

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { createRoot } from "react-dom/client";
2+
import { tryLoadAndStartRecorder } from "@alwaysmeticulous/recorder-loader";
23
import { App } from "./App";
34

45
console.info(` ▄█▀ ▀█▄
@@ -12,5 +13,28 @@ const element = document.getElementById("root");
1213
if (element === null) {
1314
throw new Error("root element is null");
1415
}
16+
1517
const root = createRoot(element);
16-
root.render(<App />);
18+
async function startApp() {
19+
// Record all sessions on localhost, staging stacks and preview URLs
20+
if (isInternal()) {
21+
// Start the Meticulous recorder before you initialise your app.
22+
// Note: all errors are caught and logged, so no need to surround with try/catch
23+
await tryLoadAndStartRecorder({
24+
projectId: "Y4uHy1qs0B660xxUdrkLPkazUMPr6OuTqYEnShaR",
25+
isProduction: false,
26+
});
27+
}
28+
29+
root.render(<App />);
30+
}
31+
32+
function isInternal() {
33+
return (
34+
window.location.hostname.indexOf("dev.coder.com") > -1 ||
35+
window.location.hostname.indexOf("localhost") > -1 ||
36+
window.location.hostname.indexOf("127.0.0.1") > -1
37+
);
38+
}
39+
40+
startApp();

0 commit comments

Comments
 (0)