Skip to content

Conversation

@yifancong
Copy link
Contributor

@yifancong yifancong commented Dec 3, 2025

Summary

optimize the treemap view

  • before:
image
  • after:
image image

Related Links

Copilot AI review requested due to automatic review settings December 3, 2025 13:03
@netlify
Copy link

netlify bot commented Dec 3, 2025

Deploy Preview for rsdoctor ready!

Name Link
🔨 Latest commit 552ac2c
🔍 Latest deploy log https://app.netlify.com/projects/rsdoctor/deploys/693180a5f87297000860c6ce
😎 Deploy Preview https://deploy-preview-1428--rsdoctor.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces significant optimizations and UX improvements to the TreeMap visualization component, bumping package versions to 1.3.13-beta.0 across the monorepo.

  • Complete UI redesign with a collapsible sidebar for better space utilization
  • New features including fullscreen mode, in-place search functionality, and multiple size type views (stat, parsed, gzipped)
  • Enhanced visual styling with updated color palettes and improved tooltip formatting

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 13 comments.

Show a summary per file
File Description
packages/webpack-plugin/package.json Version bump to 1.3.13-beta.0
packages/utils/package.json Version bump to 1.3.13-beta.0
packages/types/package.json Version bump to 1.3.13-beta.0
packages/sdk/package.json Version bump to 1.3.13-beta.0
packages/rspack-plugin/package.json Version bump to 1.3.13-beta.0
packages/graph/package.json Version bump to 1.3.13-beta.0
packages/document/package.json Version bump to 1.3.13-beta.0
packages/core/package.json Version bump to 1.3.13-beta.0
packages/components/src/components/Charts/treemap.module.scss Complete CSS rewrite with sidebar layout, fullscreen support, and search results styling
packages/components/src/components/Charts/constants.ts Updated color palette with new Ant Design colors and adjusted transparency values
packages/components/src/components/Charts/TreeMap.tsx Major refactoring adding fullscreen, search, sidebar toggle, improved tooltips, and node highlighting features
packages/components/package.json Version bump to 1.3.13-beta.0
packages/client/package.json Version bump to 1.3.13-beta.0
packages/cli/package.json Version bump to 1.3.13-beta.0

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +684 to +692
<div
key={index}
className={Styles['search-result-item']}
onClick={() => handleSearchResultClick(result.nodeId)}
title={result.path}
>
{displayPath || result.path}
</div>
);
Copy link

Copilot AI Dec 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Search result items are not keyboard accessible. These divs with onClick handlers should either be buttons or have proper keyboard accessibility attributes (role="button", tabIndex={0}, and keyboard event handlers for Enter/Space keys) to ensure users can navigate and select results using only the keyboard.

Copilot uses AI. Check for mistakes.
chartRef.current;
}
}
}, [forwardedRef, chartRef.current]);
Copy link

Copilot AI Dec 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The useEffect dependency array includes chartRef.current, which is a ref value. React refs don't trigger re-renders when their .current property changes, so including it in the dependency array is ineffective and could be misleading. The effect will only run when forwardedRef changes, not when chartRef.current changes. Consider removing chartRef.current from the dependency array.

Suggested change
}, [forwardedRef, chartRef.current]);
}, [forwardedRef]);

Copilot uses AI. Check for mistakes.
Comment on lines +510 to +513
containerRef.current
.requestFullscreen()
.then(() => setIsFullscreen(true))
.catch((err) => console.error('Failed to enter fullscreen:', err));
Copy link

Copilot AI Dec 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accessing requestFullscreen() directly may cause errors in browsers that don't support it or require vendor prefixes. Consider checking for browser support or providing a fallback:

if (containerRef.current?.requestFullscreen) {
  containerRef.current.requestFullscreen()...
} else if ((containerRef.current as any)?.webkitRequestFullscreen) {
  (containerRef.current as any).webkitRequestFullscreen();
}
Suggested change
containerRef.current
.requestFullscreen()
.then(() => setIsFullscreen(true))
.catch((err) => console.error('Failed to enter fullscreen:', err));
const el = containerRef.current as any;
if (el.requestFullscreen) {
el
.requestFullscreen()
.then(() => setIsFullscreen(true))
.catch((err: any) => console.error('Failed to enter fullscreen:', err));
} else if (el.webkitRequestFullscreen) {
try {
el.webkitRequestFullscreen();
setIsFullscreen(true);
} catch (err) {
console.error('Failed to enter fullscreen (webkit):', err);
}
} else if (el.mozRequestFullScreen) {
try {
el.mozRequestFullScreen();
setIsFullscreen(true);
} catch (err) {
console.error('Failed to enter fullscreen (moz):', err);
}
} else if (el.msRequestFullscreen) {
try {
el.msRequestFullscreen();
setIsFullscreen(true);
} catch (err) {
console.error('Failed to enter fullscreen (ms):', err);
}
} else {
console.error('Fullscreen API is not supported in this browser.');
}

Copilot uses AI. Check for mistakes.
Comment on lines +64 to +77
.sidebar-toggle {
position: absolute;
top: 10px;
right: 10px;
z-index: 20;
background: white;
border: 1px solid #ccc;
border-radius: 4px;
padding: 5px;
cursor: pointer;
transition: right 0.3s ease;

.statistics-space {
width: 100%;
}
&.collapsed {
right: -40px;
Copy link

Copilot AI Dec 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The sidebar toggle button is positioned with a fixed offset (right: 10px and right: -40px when collapsed), which may cause issues on smaller screens or when the sidebar width changes. Consider using a more responsive approach or making these values configurable.

Copilot uses AI. Check for mistakes.
Comment on lines +639 to +644
<div
className={`${Styles['sidebar-toggle']} ${collapsed ? Styles.collapsed : ''}`}
onClick={() => setCollapsed(!collapsed)}
>
<div className={`checkbox-container ${collapsed ? 'collapsed' : ''}`}>
{collapsed ? <RightOutlined /> : <LeftOutlined />}
</div>
Copy link

Copilot AI Dec 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sidebar toggle button is not keyboard accessible. While it has an onClick handler, it's a div element without proper keyboard navigation support. Consider:

  1. Using a <button> element instead
  2. Adding role="button" and tabIndex={0}
  3. Adding keyboard event handlers for Enter/Space keys

This ensures users who rely on keyboard navigation can toggle the sidebar.

Copilot uses AI. Check for mistakes.
_rect: any,
size: any,
) {
var obj = { top: pos[1] + 10 };
Copy link

Copilot AI Dec 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The var keyword is deprecated in modern JavaScript. Use const or let instead for better scoping and readability.

Suggested change
var obj = { top: pos[1] + 10 };
const obj = { top: pos[1] + 10 };

Copilot uses AI. Check for mistakes.
seriesIndex: 0,
name: nodeInfo.name,
});
} catch (e) {}
Copy link

Copilot AI Dec 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty catch blocks silently swallow errors, making debugging difficult. Consider logging the error or adding a comment explaining why the error can be safely ignored.

Suggested change
} catch (e) {}
} catch (e) {
console.error(
'Failed to highlight node with name:',
nodeInfo.name,
e,
);
}

Copilot uses AI. Check for mistakes.
@yifancong yifancong changed the title Optimize/treemap graph optimize: the treemap view Dec 4, 2025
@yifancong yifancong marked this pull request as draft December 4, 2025 11:22
@fi3ework
Copy link
Member

fi3ework commented Dec 4, 2025

commit message should starts with feat: https://www.conventionalcommits.org/en/v1.0.0/.

@yifancong yifancong changed the title optimize: the treemap view feat: optimize the treemap view Dec 4, 2025
@yifancong yifancong marked this pull request as ready for review December 4, 2025 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants