Skip to content

Conversation

@artemmufazalov
Copy link
Member

@artemmufazalov artemmufazalov commented Nov 17, 2025

Part of #2892

Stand: https://nda.ya.ru/t/BEIjuuLI7N8Qd7

Debounce is not needed for other settings, goal is to simplify useSetting hook

CI Results

Test Status: ⚠️ FLAKY

📊 Full Report

Total Passed Failed Flaky Skipped
378 374 0 2 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: 66.11 MB | Main: 66.11 MB
Diff: 0.41 KB (-0.00%)

✅ Bundle size unchanged.

ℹ️ 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.

Greptile Summary

  • Removed debounce functionality from useSetting hook to simplify it for general settings use
  • Moved debounce logic (300ms) to useTableResize hook, which is the only consumer that needs debouncing for table column resize operations

Confidence Score: 5/5

  • This PR is safe to merge with no identified issues
  • Clean refactoring that moves debounce logic from generic hook to specific use case; maintains identical behavior while improving code organization
  • No files require special attention

Important Files Changed

Filename Overview
src/store/reducers/settings/useSetting.ts Removed debounce functionality and UseSettingOptions interface to simplify the hook for general use
src/utils/hooks/useTableResize.ts Added debounce logic (300ms) for table column resize operations, maintaining the same behavior as before

Sequence Diagram

sequenceDiagram
    participant User
    participant Component as "ResizeableDataTable"
    participant Hook as "useTableResize"
    participant Debounce as "debouncedSaveSizes"
    participant Setting as "useSetting"
    participant LS as "LocalStorage/Backend"

    User->>Component: "Resize column"
    Component->>Hook: "handleSetupChange(columnId, width)"
    Hook->>Hook: "setActualSizes (immediate)"
    Hook->>Debounce: "debouncedSaveSizes(setup)"
    Note over Debounce: "Wait 300ms"
    Debounce->>Setting: "saveSizes(setup)"
    Setting->>LS: "Save to LocalStorage/Backend"
Loading

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 refactors the debounce logic from the useSetting hook into the useTableResize hook to simplify useSetting for use cases that don't require debouncing. The debounce functionality is now specific to table column resizing operations, where it prevents excessive save calls during user interactions.

  • Removes debounce options and logic from useSetting
  • Adds debounce handling directly in useTableResize with cleanup
  • Maintains 300ms debounce delay for table resize operations

Reviewed Changes

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

File Description
src/store/reducers/settings/useSetting.ts Removes debounce option parameter, debounce implementation, and related cleanup logic; simplifies the hook to always save immediately
src/utils/hooks/useTableResize.ts Adds debounce import and creates a memoized debounced save function with cleanup logic on unmount

@artemmufazalov artemmufazalov marked this pull request as ready for review November 17, 2025 18:21
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.

2 files reviewed, no comments

Edit Code Review Agent Settings | Greptile
React with 👍 or 👎 to share your feedback on this new summary format

@artemmufazalov artemmufazalov added this pull request to the merge queue Nov 18, 2025
Merged via the queue into main with commit d85e8d3 Nov 18, 2025
16 checks passed
@artemmufazalov artemmufazalov deleted the debounce-table-resize branch November 18, 2025 08:41
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.

3 participants