Skip to content

Commit

Permalink
resolving comments
Browse files Browse the repository at this point in the history
  • Loading branch information
pivanov committed Feb 10, 2025
1 parent 940410a commit a3db0ae
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
1 change: 0 additions & 1 deletion packages/scan/src/cli.mts
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,6 @@ const init = async () => {

await page.evaluate(() => {
if (typeof globalThis.reactScan !== 'function') return;
// @ts-expect-error - TODO: fix this
globalThis.reactScan({ report: true });
});

Expand Down
26 changes: 13 additions & 13 deletions packages/scan/src/web/views/inspector/components-tree/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,19 @@ const useNodeHighlighting = (
}, [node.label, node.nodeId, node.fiber, searchValue]);
};

const formatTime = (time: number) => {
if (time > 0) {
if (time < 0.1 - Number.EPSILON) {
return '< 0.1';
}
if (time < 1000) {
return Number(time.toFixed(1)).toString();
}
return `${(time / 1000).toFixed(1)}k`;
}
return '0';
};

const TreeNodeItem = ({
node,
nodeIndex,
Expand Down Expand Up @@ -273,19 +286,6 @@ const TreeNodeItem = ({
if (!node.renderData) return null;
const { selfTime, totalTime, renderCount } = node.renderData;

const formatTime = (time: number) => {
if (time > 0) {
if (time < 0.1 - Number.EPSILON) {
return '< 0.1';
}
if (time < 1000) {
return Number(time.toFixed(1)).toString();
}
return `${(time / 1000).toFixed(1)}k`;
}
return '0';
};

if (!renderCount) {
return null
};
Expand Down

0 comments on commit a3db0ae

Please sign in to comment.