Repository navigation
feat: add click-ui; change bug report anchor to use Link component - #3262
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
🦋 Changeset detectedLatest commit: b0c3b43 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
🔵 Tier 2 — Low RiskSmall, isolated change with no API route or data model modifications. Why this tier:
Review process: AI review + quick human skim (target: 5–15 min). Reviewer validates AI assessment and checks for domain-specific concerns. Stats
|
Duplicate code analysisNo new duplicate code introduced by this PR. jscpd compared this branch against |
| @@ -1,4 +1,5 @@ | |||
| import React from 'react'; | |||
| import { ClickUIProvider } from '@clickhouse/click-ui'; | |||
There was a problem hiding this comment.
🔵 minor — Importing the click-ui barrel in the app-wide provider likely adds the whole library to every page's bundle
ThemeWrapper is used by _app.tsx, so import { ClickUIProvider } from '@clickhouse/click-ui' puts the barrel in the shared bundle. The new jest mock (src/__mocks__/react-syntax-highlighter.tsx) says the barrel pulls in react-syntax-highlighter/prism and calls registerLanguage at import time, and each component also imports its own CSS. Both are side effects, so the bundler likely can't tree-shake CodeBlock, the Radix primitives, react-window and so on. Fix: import from per-component entry points if click-ui ships them, or check the size of the _app chunk with the bundle analyzer before and after this change.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
There was a problem hiding this comment.
This is a real issue. From claude:
- The fix belongs in click-ui. The asset maps need lazy loading or a split so Icon does not include 950 KB of flags and logos. A
./ClickUIProvidersubpath export would help a little but does not address the asset size. - In HyperDX, any click-ui adoption that mounts the provider pays this cost once, regardless of which components follow. The decision is whether a 315 KB gzip increase on every page is acceptable for the migration start, or whether it waits on the upstream fix.
- Prefer components that do not touch Icon while that is open: Text, Title, Container, Separator, Spacer. Avoid Link with the icon prop, Badge with icons, and Button with icons.
PR Review
2 finding(s): 🔴 0 critical · 🟠 0 major · 🔵 2 minor 1 posted as inline comment(s) on the changed lines. 1 listed below. Findings outside the changed lines1 minor
Severity is the reviewer's own estimate and is used for ordering, not filtering. No finding blocks merge automatically; a maintainer decides. |
|
Deep Review✅ No critical issues found. This is a low-risk, well-scoped first adoption of 🟡 P2 -- recommended
🔵 P3 nitpicks (4)
Reviewers (9): correctness, testing, maintainability, project-standards, kieran-typescript, performance, previous-comments, agent-native, learnings-researcher. Testing gaps:
No finding blocks merge automatically. A maintainer will expect P0/P1 findings in code this PR changes to be fixed; P2/P3 are your call -- fix or reply. Never fix findings about surrounding code here; reply instead. Do not widen the PR. How to respond |
E2E Test Results✅ All tests passed • 395 passed • 1 skipped • 1131s
Tests ran across 4 shards in parallel. |
a9a9d1a to
0b1640d
Compare
| <Notifications zIndex={999999} /> | ||
| {children} | ||
| {/* HyperDX user preferences determine the color mode, so click-ui should not persist preferences to localstorage. */} | ||
| <ClickUIProvider theme={colorScheme} persistTheme={false}> |
There was a problem hiding this comment.
🔵 minor — ClickUIProvider adds a second, always-empty toast viewport to every page next to Mantine Notifications
The PR's own test change (SpanLinkedFromSubpanel.test.tsx) shows ClickUIProvider renders an empty Radix toast viewport (role="region") on every page. That puts a second "Notifications" landmark in front of screen readers and takes over the Radix F8 hotkey, but nothing uses it because toasts still go through Mantine <Notifications>. If click-ui allows it, turn off its toast/viewport. If not, write down the decision to keep two toast systems mounted.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
0b1640d to
c135ca2
Compare
| <Notifications zIndex={999999} /> | ||
| {children} | ||
| {/* HyperDX user preferences determine the color mode, so click-ui should not persist preferences to localstorage. */} | ||
| <ClickUIProvider theme={colorScheme} persistTheme={false}> |
There was a problem hiding this comment.
🔵 minor — ClickUIProvider adds a second, always-empty toast viewport to every page
The updated SpanLinkedFromSubpanel test ("the providers add ... an empty toast viewport region") shows ClickUIProvider mounts a Radix Toast viewport. In _app.tsx and Storybook that means every page now has an empty role="region" "Notifications (F8)" landmark next to Mantine's <Notifications>, and it takes over the F8 hotkey, even though nothing in HyperDX uses click-ui toasts. If ClickUIProvider has an option to turn off its toast/tooltip sub-providers, use it. If not, mount only the theme provider click-ui exports so the app has one notification system.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
| @@ -1,4 +1,5 @@ | |||
| import React from 'react'; | |||
| import { ClickUIProvider } from '@clickhouse/click-ui'; | |||
There was a problem hiding this comment.
🔵 minor — Barrel import of click-ui in _app likely puts all of click-ui in the shared bundle
ThemeWrapper is rendered by pages/_app.tsx, so this import loads on every page. The new mock in src/__mocks__/react-syntax-highlighter.tsx says the barrel touches react-syntax-highlighter (registerLanguage) at import time. Module-level side effects like that stop tree-shaking, so CodeBlock's prism/highlight.js/refractor, the date picker, sortablejs and react-window probably all end up in the common chunk just to render one Link. Add experimental.optimizePackageImports: ['@clickhouse/click-ui'] (or import from per-component entry points if the package has them), then compare next build chunk sizes before and after.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
There was a problem hiding this comment.
Confirmed. The _app chunk grows by 315 KB gzip. Per-component imports do not help, since Link and the provider both pull in click-ui's Icon, which bundles every flag and logo SVG as React components, about 950 KB minified. Click-ui ships no provider subpath. The fix is upstream in click-ui's asset loading. We decide here whether to accept the cost for the first adoption step.
What to do
- The fix belongs upstream in click-ui. The asset maps need lazy loading or a split so Icon does not carry 950 KB of flags and logos. A ./ClickUIProvider subpath export would help a little but does not address the asset weight.
- In HyperDX, any click-ui adoption that mounts the provider pays this cost once, regardless of which components follow. The decision is whether a 315 KB gzip increase on every page is acceptable for the migration start, or whether it waits on the upstream fix.
- Prefer components that do not touch Icon while that is open: Text, Title, Container, Separator, Spacer. Avoid Link with the icon prop, Badge with icons, and Button with icons.
c135ca2 to
fd8f0db
Compare
fd8f0db to
4877de1
Compare
4877de1 to
5c1982f
Compare
| @@ -398,6 +398,24 @@ The UI is built with **Mantine components**, but **colors and surfaces** should | |||
|
|
|||
| Mantine theme overrides in `packages/app/src/theme/**` may map Mantine’s scale to our palette; that does not replace using **`var(--color-...)`** in new styling where you need explicit color control. | |||
|
|
|||
| ## Click UI (incremental adoption) | |||
There was a problem hiding this comment.
🔵 minor — New Click UI section splits the semantic-tokens section, so the chart-colors rule now sits under the Click UI heading
Move the ## Click UI (incremental adoption) block below the "Chart and visualization colors are a separate, more specific contract" paragraph. That paragraph belongs to "Semantic design tokens", and right now it reads as part of the Click UI guidance.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
| follows the HyperDX color mode and never writes its own theme to localStorage. | ||
| Storybook and `renderWithMantine` in tests get the provider for free. | ||
|
|
||
| - **Do**: Prefer a click-ui component over a new Mantine one when click-ui has |
There was a problem hiding this comment.
🔵 minor — New 'prefer click-ui over Mantine' rule contradicts the existing 'Prefer Mantine components' rule in the same doc
The base convention under "Mantine UI Components" says "Prefer Mantine components over custom-styled elements". The new bullet tells contributors to pick click-ui Text/Title/Badge/Container over Mantine. Reword one of the two rules (e.g. scope the Mantine rule, or limit the click-ui rule to Link for now) so the doc doesn't give conflicting guidance.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
| <Notifications zIndex={999999} /> | ||
| {children} | ||
| {/* HyperDX user preferences determine the color mode, so click-ui should not persist preferences to localstorage. */} | ||
| <ClickUIProvider theme={colorScheme} persistTheme={false}> |
There was a problem hiding this comment.
🔵 minor — ClickUIProvider adds a second, always-empty toast viewport landmark next to Mantine Notifications
The SpanLinkedFromSubpanel.test.tsx change shows that the provider now renders an empty role="region" toast viewport on every page. Mantine Notifications already provides one. Screen-reader users get two notification landmarks, plus the Radix viewport's hotkey listener. Turn off click-ui's toast provider/viewport if it has an option for that, or note it as a known cost until click-ui toasts are actually used.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
| export const InErrorMessage: Story = { | ||
| render: () => ( | ||
| <Stack gap="xs"> | ||
| <Text> |
There was a problem hiding this comment.
🔵 minor — InErrorMessage story uses click-ui Text inside a Mantine Stack, which doesn't match real usage and breaks the doc's own 'don't mix libraries' rule
In production, ContactSupportText renders inside a Mantine notifications.show message (DBSearchPage.tsx:1621, DBDashboardPage.tsx:2833). Render the story inside a Mantine Notification color="red" instead, so it actually catches the font/color regression the new .inlineLink stylesheet is meant to prevent.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
| <Stack gap="xs"> | ||
| <Text> | ||
| An error occurred. <ContactSupportText /> | ||
| </Text> |
There was a problem hiding this comment.
Mixed UI libraries The new
InErrorMessage story nests click-ui’s Text inside Mantine’s Stack. The repository’s Click UI guidance says not to mix the two libraries inside one small component. This requirement must be satisfied before merging.
Context Used: AGENTS.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
5c1982f to
32e2ae9
Compare
| @@ -1,4 +1,5 @@ | |||
| import React from 'react'; | |||
| import { ClickUIProvider } from '@clickhouse/click-ui'; | |||
There was a problem hiding this comment.
🔵 minor — All of click-ui is loaded on every page just to render one Link
ThemeWrapper (mounted in pages/_app.tsx) and ContactSupportText import from the @clickhouse/click-ui barrel. The new __mocks__/react-syntax-highlighter.tsx comment confirms that barrel pulls in react-syntax-highlighter, prism, refractor and highlight.js when the module is imported, along with about 15 Radix packages. Run next build and compare the _app chunk size before and after. If it grew, import Link and ClickUIProvider from per-component entry points, or hold off on mounting the provider app-wide until more click-ui components are in use.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
| <MantineProvider> | ||
| global.TestProviders = ({ children }: { children: React.ReactNode }) => ( | ||
| <MantineProvider> | ||
| <ClickUIProvider theme="dark" persistTheme={false}> |
There was a problem hiding this comment.
🔵 minor — Test providers hardcode a dark click-ui theme while Mantine renders in light
TestProviders renders <MantineProvider> (Mantine's default is light) but passes ClickUIProvider theme="dark". ThemeWrapper drives both providers from the same colorScheme. Use one shared constant here, e.g. const scheme = 'light', and pass it as both forceColorScheme={scheme} and theme={scheme}, so tests run with the same pairing as production.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
| <span> | ||
| Please open an issue on{' '} | ||
| <a href={GH_LINK} target="_blank"> | ||
| <Link |
There was a problem hiding this comment.
🔵 minor — Global a { color: inherit; text-decoration: none } overrides click-ui Link's color and underline
packages/app/styles/globals.css:7 is unlayered and loaded in _app.tsx and Storybook. Per this PR's own note, click-ui styles sit in the clickui cascade layer, so that global rule beats the Link's color and underline. The 'GitHub' link then looks like the surrounding toast text, as it did before. Scope the global reset with :where(a:not([class])), or move it into a lower layer. Otherwise every click-ui Link the new guideline asks for will lose its styling the same way.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
| <Notifications zIndex={999999} /> | ||
| {children} | ||
| {/* HyperDX user preferences determine the color mode, so click-ui should not persist preferences to localstorage. */} | ||
| <ClickUIProvider theme={colorScheme} persistTheme={false}> |
There was a problem hiding this comment.
🔵 minor — ClickUIProvider adds a second, always-empty toast region to every page
The updated SpanLinkedFromSubpanel test confirms the provider renders an empty toast viewport (role="region"). In the app this sits next to Mantine's <Notifications>, so screen readers get an extra empty 'Notifications' landmark and the toast viewport's hotkey listener is registered globally. Nothing in the app uses click-ui toasts. Turn off click-ui's toast provider through ClickUIProvider's config, or only mount it once click-ui toasts are actually used.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
| }; | ||
|
|
||
| export const InErrorMessage: Story = { | ||
| render: () => ( |
There was a problem hiding this comment.
🔵 minor — Stack gap="xs" in InErrorMessage wraps a single child, so the gap never applies
Remove the Stack and the @mantine/core import and render the click-ui <Text> directly. That also drops the Mantine/click-ui mix that the new code_style section tells people to avoid in small components.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
Summary
ClickUIProvider(alongsideMantineProvider) to get access to click-ui's styles, themes, and tokensClickUIProvider<a>element in the error toast call to action to open an issue into a click-ui<Link>component.Screenshots or video
Before
After
How to test on Vercel preview
Steps:
Chrome:
/api/saved-search/
Firefox:
/api/saved-search/