Skip to content

fix: initial params in useEffect #2321

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 26, 2025
Merged

fix: initial params in useEffect #2321

merged 2 commits into from
May 26, 2025

Conversation

astandrik
Copy link
Collaborator

@astandrik astandrik commented May 25, 2025

Closes #2315

CI Results

Test Status: ⚠️ FLAKY

📊 Full Report

Total Passed Failed Flaky Skipped
318 317 0 1 0

😟 No changes in tests. 😕

Bundle Size: ✅

Current: 83.62 MB | Main: 83.62 MB
Diff: 0.76 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.

Copy link
Contributor

@Copilot 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 adds mock node data generation, enables a mock mode in getStorageNodes based on URL parameters, and removes initial sort and entity initialization from the paginated table component.

  • Introduce generateNodes and related mock data helpers in nodes.ts
  • Conditionally switch to mock data in getStorageNodes.ts when ?mocks is present
  • Remove initialSortParams prop and its setup effect in PaginatedTable.tsx

Reviewed Changes

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

File Description
src/containers/Storage/PaginatedStorageNodesTable/nodes.ts Add functions to generate mock nodes, disks, and system stats
src/containers/Storage/PaginatedStorageNodesTable/getNodes.ts Use URL flag ?mocks to return generated nodes instead of API call
src/components/PaginatedTable/PaginatedTable.tsx Drop initialSortParams, remove initialization useEffect, update comments
Comments suppressed due to low confidence (2)

src/containers/Storage/PaginatedStorageNodesTable/getNodes.ts:52

  • [nitpick] The URL parameter name pdisks differs from the option maxPdisks, which can cause confusion. Consider renaming the query parameter to maxPdisks for consistency.
const pdisks = parseInt(urlParams.get('pdisks') || '10', 10);

src/components/PaginatedTable/PaginatedTable.tsx:30

  • Removing initialSortParams and its setup effect may break consumers that rely on an initial sort being applied. Ensure all parent components and documentation are updated accordingly or reintroduce an explicit initialization mechanism.
initialSortParams?: SortParams;

@astandrik astandrik added this pull request to the merge queue May 26, 2025
@astandrik astandrik removed this pull request from the merge queue due to a manual request May 26, 2025
@astandrik astandrik added this pull request to the merge queue May 26, 2025
Merged via the queue into main with commit 28a51ed May 26, 2025
10 of 11 checks passed
@astandrik astandrik deleted the astandrik.2315 branch May 26, 2025 10:31
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.

Pass initialSortParams and initialEntitiesCount as part of initial state?
2 participants