Skip to content

Conversation

@astandrik
Copy link
Collaborator

@astandrik astandrik commented Dec 9, 2025

Closes #2342
Closes #2341
Stand

CI Results

Test Status: ⚠️ FLAKY

📊 Full Report

Total Passed Failed Flaky Skipped
384 381 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.52 MB | Main: 62.50 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

Remove global Redux tooltip and migrate tooltips to local Gravity UI Popups across components with TypeScript and i18n updates.

  • State/Store:
    • Remove tooltip reducer, actions, and types; clean up store config (configureStore.ts); drop ReduxTooltip from App.
  • Query Result Table:
    • Cell: add click-to-toggle Popup showing cell value; add __cell-popup styles.
  • Heatmap:
    • Use local Popup for tablet tooltips with anchor positioning; add hover handling.
    • Convert HeatmapCanvas to TS; draw tablets and report tooltip positions via callbacks.
    • Replace Histogram with TS version using local Popup and i18n; add tooltip styles.
  • Network Diagnostics:
    • Replace Redux tooltip with NodeTooltipPopup; manage tooltip state locally.
    • Extract Nodes, NetworkPlaceholder; add i18n and styles; move groupNodesByField to utils.
  • Misc:
    • Minor typing/dep updates in QueryResultTable.tsx; SCSS additions for tooltips.

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

Greptile Overview

Greptile Summary

This PR successfully removes the Redux-based global tooltip system and migrates to component-local state management using Gravity UI's Popup component. The refactoring improves code maintainability by eliminating global state for UI concerns and provides better encapsulation.

Key Changes:

  • Removed ReduxTooltip component, tooltip reducer, actions, and type definitions
  • Migrated Cell, Heatmap, HeatmapCanvas, Histogram, and Network components to use local Popup state
  • Converted HeatmapCanvas and Histogram from JavaScript to TypeScript with proper typing
  • Added i18n support for tooltip labels (replacing hardcoded strings)
  • Moved tooltip styles from centralized ReduxTooltip.scss to component-specific stylesheets
  • Cleaned up Redux store configuration (removed tooltip-related middleware exceptions)

Issues Found:

  • Network.tsx uses hardcoded class names 'loader' and 'error' instead of BEM convention with b() utility (lines 92, 99)

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 (useState, useCallback, useMemo), and TypeScript migrations add type safety. The only issues are minor style violations (hardcoded class names in Network.tsx) 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 5/5 Updated to use new Cell component; column preparation logic properly memoized with useMemo dependencies
src/containers/Heatmap/Heatmap.tsx 5/5 Replaced Redux tooltip with local state management using useState; proper hover handling with refs to track tooltip hover state
src/containers/Heatmap/HeatmapCanvas/HeatmapCanvas.tsx 5/5 Converted from JS to TypeScript with proper typing; uses callback pattern to notify parent of tooltip position changes
src/containers/Heatmap/Histogram/Histogram.tsx 5/5 Migrated from JS to TS; replaced Redux tooltip with local Popup; added comprehensive error handling for edge cases (NaN, infinity, out of bounds)
src/containers/Tenant/Diagnostics/Network/Network.tsx 4/5 Replaced Redux tooltip with local NodeTooltipPopup component; uses hardcoded class names 'loader' and 'error' instead of BEM convention on lines 92 and 99
src/store/reducers/index.ts 5/5 Removed tooltip reducer from root reducer; clean removal with no leftover references

Sequence Diagram

sequenceDiagram
    participant User
    participant Component
    participant LocalState
    participant Popup
    participant Redux

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

    Note over User,Redux: New Flow (Local state)
    User->>Component: Hover/Click on Cell/Node/Histogram
    Component->>LocalState: setState({anchor, data})
    LocalState->>Popup: Render Gravity UI Popup
    Popup->>User: Display tooltip
    User->>Popup: Click outside or leave
    Popup->>Component: onOutsideClick/onMouseLeave
    Component->>LocalState: Clear tooltip state
    LocalState->>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)

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

Raubzeug
Raubzeug previously approved these changes Dec 15, 2025
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 28 out of 28 changed files in this pull request and generated no new 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.

24 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@astandrik astandrik added this pull request to the merge queue Dec 16, 2025
Merged via the queue into main with commit 2a6c613 Dec 16, 2025
18 checks passed
@astandrik astandrik deleted the astandrik.2342-3 branch December 16, 2025 12:44
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