Skip to content

Conversation

kmandryk
Copy link
Collaborator

@kmandryk kmandryk commented Apr 17, 2025

This PR closes issue: [DM-42]

Includes tests? [N]
Updated docs? [N]

Proposed changes:

  • Implemented virtualized table for the users page to improve performance. The table displays only the records that are currently present on the screen.
  • Added search box to the users page to allow searching users by name (since it's no longer possible to do so with browser search function)
  • Replaced correlated subqueries with DISTINCT ON window functions to improve query performance
  • Created indices for various tables to improve query performance

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@kmandryk kmandryk requested a review from IanFonzie April 23, 2025 19:07
}

// Helper function to scroll the virtualized table container to top
function scrollContainerToTop(): void {
Copy link
Collaborator

Choose a reason for hiding this comment

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

See component_.cmd.scrollTo

Copy link
Collaborator

Choose a reason for hiding this comment

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

component_.cmd.scrollTo scrolls the document, but in this component we have a scrollable component. I have added a separate command called cmd.scrollContainerTo to cover this case.

state.visibleRange.end
);
const bodyRows = generateBodyRows(visibleUsersSlice);
const TableView = Table.view;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Using the built-in Table feels redundant here, given that we're only using it for its header. Theoretically, if someone were to use tooltips or add new messages for it in the future, the updates would not fire.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I was able to eliminate the use of a table just for the purposes of the header, but the fix was fairly involved and required modifying the table body with custom markup to embed scrollable container inside the table: 787b91e

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't know about this component; I get the use case, but it doesn't follow the established state management of the app. I think it could work with some tweaks, i.e. abstracting it out into its own component like Table, but it will probably be complicated. If you want to try that go for it, but an alternative could be pagination which is already supported in the app.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I created a separate component, similar to Table which can now be re-used in other parts of the application.

state
.set("scrollTop", 0)
.set("visibleRange", { start: 0, end: initialEnd }),
[component_.cmd.delayedDispatch(10, adt("scrollToTop", null))]
Copy link
Collaborator

Choose a reason for hiding this comment

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

This seems to be doing nearly the same thing as init; will the component still work if we add this command to init an call init wherever we're dispatching nested resetScroll messages? i.e., when handling onInitResponse and search messages in src/front-end/typescript/lib/pages/user/list.tsx

Copy link
Collaborator

Choose a reason for hiding this comment

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

Refactored the code to eliminate "resetScroll" event and replaced it with calls to the init function, that now returns a command to scroll to the top of the component.

Copy link
Collaborator

@IanFonzie IanFonzie left a comment

Choose a reason for hiding this comment

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

Looks good!

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)
E Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@alex-struk alex-struk merged commit 258aff1 into development Jul 29, 2025
6 of 7 checks passed
@alex-struk alex-struk deleted the refactor/optimize-page-loading branch July 29, 2025 16:21
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