Skip to content

Conversation

@astandrik
Copy link
Collaborator

@astandrik astandrik commented Dec 9, 2025

Closes #2342
Stand

CI Results

Test Status: ⚠️ FLAKY

📊 Full Report

Total Passed Failed Flaky Skipped
378 375 0 1 2
Test Changes Summary ⏭️2

⏭️ Skipped Tests (2)

  1. Scroll to row, get shareable link, navigate to URL and verify row is scrolled into view (tenant/diagnostics/tabs/queries.test.ts)
  2. Copy result button copies to clipboard (tenant/queryEditor/queryEditor.test.ts)

Bundle Size: 🔺

Current: 62.51 MB | Main: 62.48 MB
Diff: +0.02 MB (0.03%)

⚠️ Bundle size increased. Please review.

ℹ️ CI Information
  • Test recordings for failed tests are available in the full report.
  • Bundle size is measured for the entire 'dist' directory.
  • 📊 indicates links to detailed reports.
  • 🔺 indicates increase, 🔽 decrease, and ✅ no change in bundle size.
## Key Changes - Removed `ReduxTooltip` component, tooltip reducer, actions, and type definitions from the Redux store - Migrated tooltip implementations to use Gravity UI's `Popup` component with local state management - Converted `Histogram.js` and `HeatmapCanvas.js` from JavaScript to TypeScript with proper typing - Added i18n support for tooltip labels in Network and Histogram components - Moved tooltip CSS styles from centralized `ReduxTooltip.scss` to individual component stylesheets

Improvements

  • Better encapsulation: each component manages its own tooltip state
  • Type safety: TypeScript migration adds compile-time safety
  • Internationalization: hardcoded labels replaced with i18n keys
  • Cleaner architecture: eliminated global tooltip state and Redux boilerplate

Minor Issues

  • Network.tsx uses hardcoded class names 'error' and 'loader' instead of BEM convention (addressed in style comments)

Confidence Score: 4/5

  • This PR is safe to merge with minor style improvements recommended
  • The refactoring is well-executed with comprehensive cleanup of the old tooltip system. All Redux dependencies removed, new implementations use proper React patterns (useReducer, useCallback, useMemo), and TypeScript migrations add type safety. The only issues are minor style violations (hardcoded class names) that don't affect functionality. Tests show only 1 flaky test unrelated to tooltip changes.
  • Network.tsx should use BEM naming convention for CSS classes, but this is a minor style issue

Important Files Changed

File Analysis

Filename Score Overview
src/components/QueryResultTable/QueryResultTable.tsx 4/5 Implemented local state management for cell tooltips using useReducer; renderCell function properly memoized with stable dependencies
src/containers/Heatmap/Heatmap.tsx 5/5 Replaced Redux tooltip with local Popup state management; added proper hover state handling for tablet tooltips
src/containers/Heatmap/HeatmapCanvas/HeatmapCanvas.tsx 5/5 Migrated from JS to TypeScript; replaced Redux tooltip with callback-based tooltip positioning; proper typing and bounds checking added
src/containers/Heatmap/Histogram/Histogram.tsx 5/5 Converted from JS to TypeScript; replaced Redux tooltip with local Popup state; added comprehensive error handling and i18n support
src/containers/Tenant/Diagnostics/Network/Network.tsx 4/5 Replaced Redux tooltip with local Popup state; uses hardcoded 'error' and 'loader' class names instead of BEM
src/store/reducers/index.ts 5/5 Removed tooltip reducer from root reducer

Sequence Diagram

sequenceDiagram
    participant User
    participant Component
    participant Popup
    participant State

    Note over User,State: Old Flow (Redux-based)
    User->>Component: Hover/Click
    Component->>Redux: dispatch(showTooltip())
    Redux->>ReduxTooltip: Update global state
    ReduxTooltip->>Popup: Render tooltip
    User->>Component: Move away
    Component->>Redux: dispatch(hideTooltip())
    Redux->>ReduxTooltip: Clear state
    ReduxTooltip->>Popup: Hide tooltip

    Note over User,State: New Flow (Local state)
    User->>Component: Hover/Click on Cell/Node/Histogram
    Component->>State: setState with tooltip data
    State->>Popup: Render Gravity UI Popup
    Popup->>User: Display tooltip
    User->>Popup: Click outside or leave
    Popup->>State: Clear tooltip state
    State->>Popup: Hide tooltip
Loading

Context used:

  • Rule from dashboard - Use the BEM naming convention with the b() utility function for CSS classes instead of hardcoded c... (source)
  • Rule from dashboard - Remove unused interfaces and CSS classes that are added during development. Clean up duplicate code ... (source)

Note

Replaces global Redux tooltips with component-local Gravity UI Popups in QueryResultTable, Heatmap, Histogram, and Network; removes tooltip store and adds TS/i18n updates.

  • Core
    • Remove global tooltip infrastructure: ReduxTooltip component, store/reducers/tooltip, types/store/tooltip, and utils/tooltip; drop tooltip wiring from App.tsx, store config, and root reducers.
  • UI
    • QueryResultTable:
      • Add click-to-open cell tooltip via Popup in Cell.tsx; add __cell-popup styles.
    • Heatmap:
      • Implement tablet hover tooltip with Popup; add anchor/hover handling.
      • Refactor HeatmapCanvas to TypeScript and emit tooltip coordinates via callbacks.
      • Rewrite Histogram to TypeScript with local Popup tooltip and i18n.
    • Network:
      • Replace Redux tooltip with NodeTooltipPopup and local state; add NetworkPlaceholder and Nodes component; extract helpers to utils.ts; add i18n.
  • Styles
    • Move tooltip styling into component SCSS (QueryResultTable.scss, Heatmap.scss, Histogram.scss, Network.scss).

Written by Cursor Bugbot for commit 3242259. This will update automatically on new commits. Configure here.

Greptile Overview

Greptile Summary

This PR successfully removes the global Redux-based tooltip system and replaces it with component-local Gravity UI Popup implementations. The refactoring improves code organization by giving each component ownership of its tooltip state through useState and useCallback hooks.

Key Changes:

  • Removed ReduxTooltip component, tooltip reducer, actions, and utilities
  • Migrated 4 components to use local Popup tooltips: Cell, Heatmap, Histogram, and Network
  • Converted HeatmapCanvas and Histogram from JavaScript to TypeScript with proper typing
  • Added internationalization support for tooltip labels in Histogram and Network components
  • Moved tooltip styles from centralized ReduxTooltip.scss to component-specific stylesheets

Implementation Quality:

  • All new tooltip implementations use proper React patterns (local state, memoized callbacks, stable dependencies)
  • TypeScript migrations add compile-time safety with proper type definitions
  • Edge case handling improved in Histogram (division by zero, NaN values, out-of-range buckets)
  • CSS styles properly migrated to component stylesheets

Minor Style Issues:

  • Network.tsx:92-99 uses hardcoded class names 'loader' and 'error' instead of BEM convention with b() utility (violates style guide rule 2bea9cbf-2d5a-4f2d-8669-abfdb73f2fc4)

Confidence Score: 4/5

  • This PR is safe to merge with minor style improvements recommended
  • The refactoring is well-executed with comprehensive cleanup of the old tooltip system. All Redux dependencies removed, new implementations use proper React patterns, and TypeScript migrations add type safety. Only minor style violations (hardcoded class names in Network.tsx) that don't affect functionality.
  • Network.tsx should use BEM naming convention for CSS classes

Important Files Changed

File Analysis

Filename Score Overview
src/components/QueryResultTable/Cell/Cell.tsx 5/5 Replaced Redux tooltip with local Popup state; click-to-toggle cell value popup with proper memoization
src/containers/Heatmap/Heatmap.tsx 5/5 Replaced Redux tooltip with local Popup state; proper hover state handling with tooltip anchor positioning
src/containers/Heatmap/HeatmapCanvas/HeatmapCanvas.tsx 5/5 Migrated from JS to TypeScript; replaced Redux tooltip with callback-based positioning; added proper types
src/containers/Heatmap/Histogram/Histogram.tsx 5/5 Converted from JS to TypeScript; replaced Redux tooltip with local Popup state; added i18n and error handling
src/containers/Tenant/Diagnostics/Network/Network.tsx 4/5 Replaced Redux tooltip with local Popup state; uses hardcoded 'error' and 'loader' class names instead of BEM convention
src/store/reducers/index.ts 5/5 Removed tooltip reducer from root reducer; clean Redux cleanup

Sequence Diagram

sequenceDiagram
    participant User
    participant Component
    participant LocalState
    participant Popup

    Note over User,Popup: Old Flow (Redux-based)
    User->>Component: Hover/Click
    Component->>Redux: dispatch(showTooltip())
    Redux->>ReduxTooltip: Update global state
    ReduxTooltip->>Popup: Render at coordinates
    User->>Component: Move away
    Component->>Redux: dispatch(hideTooltip())

    Note over User,Popup: New Flow (Local State)
    User->>Component: Hover on Cell/Node/Histogram
    Component->>LocalState: setState({anchor, data})
    LocalState->>Popup: Render Gravity UI Popup
    Popup->>User: Display tooltip
    User->>Popup: Click outside / Mouse leave
    Popup->>LocalState: Clear state
    LocalState->>Component: Hide tooltip
Loading

Context used:

  • Rule from dashboard - Use the BEM naming convention with the b() utility function for CSS classes instead of hardcoded c... (source)

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

17 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

17 files reviewed, 3 comments

Edit Code Review Agent Settings | Greptile

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 removes the centralized Redux-based tooltip system (ReduxTooltip) and replaces it with local state-based tooltip management using Gravity UI's Popup component in individual components. This simplifies the architecture by eliminating global tooltip state and reduces Redux boilerplate.

  • Removes Redux tooltip slice, actions, and middleware configuration
  • Migrates three tooltip use cases to local implementations: Network node tooltips, Heatmap histogram/tablet tooltips, and QueryResultTable cell tooltips
  • Converts Histogram component from JavaScript to TypeScript with proper typing

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/utils/tooltip.js Deleted: Removed tooltip template definitions (node, histogram, cell, tablet)
src/types/store/tooltip.ts Deleted: Removed Redux tooltip type definitions
src/store/reducers/tooltip.ts Deleted: Removed Redux tooltip reducer and action creators
src/store/reducers/index.ts Removed tooltip reducer from root reducer configuration
src/store/configureStore.ts Removed tooltip-specific Redux middleware configuration for immutability/serializability checks
src/containers/ReduxTooltip/ReduxTooltip.scss Deleted: Removed centralized tooltip styles
src/containers/ReduxTooltip/ReduxTooltip.js Deleted: Removed Redux-connected tooltip container component
src/containers/App/App.tsx Removed ReduxTooltip component from app root
src/containers/Tenant/Diagnostics/Network/NodeNetwork/NodeNetwork.tsx Added TypeScript types for tooltip data and improved null safety
src/containers/Tenant/Diagnostics/Network/Network.tsx Implemented local tooltip state with Popup component for node tooltips
src/containers/Heatmap/Histogram/Histogram.tsx New: Converted from JS to TS, added local tooltip state management
src/containers/Heatmap/Histogram/Histogram.js Deleted: Replaced by TypeScript version
src/containers/Heatmap/HeatmapCanvas/HeatmapCanvas.tsx Converted from JS to TS with proper typing, improved tooltip positioning logic
src/containers/Heatmap/Heatmap.tsx Implemented local tablet tooltip state with hover persistence logic
src/components/QueryResultTable/QueryResultTable.tsx Added local active cell state management for cell tooltips
src/components/QueryResultTable/QueryResultTable.scss Added cell popup styles (migrated from ReduxTooltip.scss)
src/components/QueryResultTable/Cell/Cell.tsx Implemented inline Popup component for cell tooltips

@astandrik astandrik requested a review from Copilot December 9, 2025 14:09
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

19 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

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

Copilot reviewed 19 out of 19 changed files in this pull request and generated 10 comments.

Comments suppressed due to low confidence (2)

src/containers/Heatmap/HeatmapCanvas/HeatmapCanvas.tsx:83

  • Potential division by zero when calculating rowsCount if columnsCount is 0 (which could happen if container width is very small). Add a safety check:
const columnsCount = Math.floor(width / (TABLET_SIZE + TABLET_PADDING));
if (columnsCount === 0) {
    return; // or set some default dimensions
}
const rowsCount = Math.ceil(tabletsLength / columnsCount);

src/containers/Heatmap/HeatmapCanvas/HeatmapCanvas.tsx:198

  • The throttled function _onCanvasMouseMove is recreated on every render. Wrap it with useMemo or useCallback to maintain the same throttled instance across renders:
const _onCanvasMouseMove = React.useMemo(
    () => throttle((x: number, y: number) => {
        const parent = props.parentRef.current;
        if (!parent) {
            return;
        }

        const xPos = x - getOffsetLeft() + parent.scrollLeft;
        const yPos = y - getOffsetTop() + parent.scrollTop;

        const tabletIndex = getTabletIndex(xPos, yPos);
        const tablet = tablets[tabletIndex];

        if (tablet) {
            const {columnsCount} = dimensions;
            const colIndex = tabletIndex % columnsCount;
            const rowIndex = Math.floor(tabletIndex / columnsCount);

            const rectX = colIndex * (TABLET_SIZE + TABLET_PADDING);
            const rectY = rowIndex * (TABLET_SIZE + TABLET_PADDING);

            const left = getOffsetLeft() - parent.scrollLeft + rectX + TABLET_SIZE / 2;
            const top = getOffsetTop() - parent.scrollTop + rectY + TABLET_SIZE / 2;

            onShowTabletTooltip(tablet, {left, top});
        } else {
            onHideTabletTooltip();
        }
    }, 20),
    [tablets, dimensions, onShowTabletTooltip, onHideTabletTooltip, props.parentRef]
);

Also consider cleanup: return a cleanup function from useEffect to cancel the throttled function on unmount.

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

23 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

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

Copilot reviewed 27 out of 27 changed files in this pull request and generated 5 comments.

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

23 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

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

Copilot reviewed 27 out of 27 changed files in this pull request and generated 3 comments.

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

23 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

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

Copilot reviewed 27 out of 27 changed files in this pull request and generated 2 comments.

@astandrik astandrik marked this pull request as ready for review December 9, 2025 15:50
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

24 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

@astandrik
Copy link
Collaborator Author

@cursor review

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

24 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@Raubzeug Raubzeug linked an issue Dec 11, 2025 that may be closed by this pull request
};
};

function activeCellReducer(state: ActiveCellState, action: ActiveCellAction): ActiveCellState {
Copy link
Contributor

Choose a reason for hiding this comment

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

lets delegate this logic to Cell components. It will simplify structure a lot.

cursor: pointer;
}

&__tooltip-anchor {
Copy link
Contributor

Choose a reason for hiding this comment

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

please add paddings
Screenshot 2025-12-11 at 17 53 55

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

24 files reviewed, no comments

Edit Code Review Agent Settings | Greptile


return null;
});
}, [isTabletTooltipHovered]);
Copy link

Choose a reason for hiding this comment

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

Bug: Stale closure causes tooltip to hide when hovered

The handleRequestHideTabletTooltip callback captures isTabletTooltipHovered from its closure, but when called from the setTimeout in HeatmapCanvas._onCanvasMouseLeave, it uses a stale value. When the user moves their mouse from the canvas to the tooltip, the setTimeout fires with the old function reference that has isTabletTooltipHovered = false captured, causing the tooltip to hide even though the user is hovering over it. The isTabletTooltipHovered check is effectively bypassed because the timeout callback was created before the hover state changed.

Additional Locations (1)

Fix in Cursor Fix in Web

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

24 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

24 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

@astandrik astandrik requested a review from Raubzeug December 11, 2025 17:09
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

24 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

<TabletTooltipContent data={tabletTooltip.tablet} />
</div>
</Popup>
) : null}
Copy link

Choose a reason for hiding this comment

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

Bug: Popup may render before anchor element is ready

The Popup component receives tabletTooltipAnchorElement which is null on the first render cycle when tabletTooltip becomes truthy. The anchor div is created with a callback ref (setTabletTooltipAnchorElement), but this state update only takes effect after the initial render. This means the Popup opens with a null anchor element initially, potentially causing it to appear in the wrong position or not at all until the second render.

Additional Locations (1)

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Get rid of ReduxTooltip Move Heatmap and its components to typescript

3 participants