Skip to content

Sync staging: preserve server-grid filter state#180

Merged
VibhavSetlur merged 1 commit intoModelSEED:stagingfrom
VibhavSetlur:staging
May 5, 2026
Merged

Sync staging: preserve server-grid filter state#180
VibhavSetlur merged 1 commit intoModelSEED:stagingfrom
VibhavSetlur:staging

Conversation

@VibhavSetlur
Copy link
Copy Markdown
Collaborator

Summary

  • Syncs latest VibhavSetlur:staging into ModelSEED:staging
  • Carries the remaining commit not yet in upstream staging:
    • 18dcf9e fix(ui): preserve grid state when using onApplyFilterModel for server pages

Why

  • Ensures server-backed DataGrid pages keep committed filter state while toolbar quick-filter changes are applied.
  • Aligns behavior across biochem and build-model tables.

Scope

  • components/layout/DataControlHeader.tsx
  • components/build-model/PatricGenomesTable.tsx

Validation

  • Branch sync verified:
    • develop == staging == origin/develop == origin/staging
  • Upstream divergence before PR:
    • upstream/staging...origin/staging = 0 1

Made with Cursor

… pages

- DataControlHeader: also update grid's filterModel when onApplyFilterModel is
  provided, so GridHighlightText and filter badge reflect current state
- PatricGenomesTable: fix multi-filter truncation logic to allow intentional
  clear (when incomingItems.length === 0)
- PatricGenomesTable: wire onApplyFilterModel so toolbar receives full
  multi-filter model for server-side filtering
Copilot AI review requested due to automatic review settings May 5, 2026 16:08
@VibhavSetlur VibhavSetlur merged commit 29f309b into ModelSEED:staging May 5, 2026
1 check passed
Copy link
Copy Markdown

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

Syncs staging while carrying a remaining UI fix intended to preserve committed (multi-)filter state on server-backed MUI DataGrid pages when toolbar quick-filter/search updates occur, aligning behavior across tables.

Changes:

  • Updates DataControlHeader to additionally sync the grid’s internal filterModel (truncated to CE limits) after applying the full model via onApplyFilterModel for server pages.
  • Updates PatricGenomesTable to accept toolbar-applied filter models and to refine truncation-vs-clear handling in onFilterModelChange.

Reviewed changes

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

File Description
components/layout/DataControlHeader.tsx After toolbar “Save” on server pages, applies the full filter model via callback and then sets a truncated grid-internal model so UI features (badge/highlight) stay in sync.
components/build-model/PatricGenomesTable.tsx Adds a toolbar apply handler + adjusts filter change logic to preserve committed filters across truncation and handle clears, wiring onApplyFilterModel into DataControlHeader.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +191 to +192
// Only update committed refs if we're not clearing (incoming has items or was truncation)
if (incomingItems.length > 0 || incomingItems.length >= committedFilterItemsRef.current.length) {
Comment on lines +132 to +145
const handleToolbarApplyFilterModel = (model: GridFilterModel) => {
// Store the full multi-filter from the toolbar (bypasses grid truncation)
committedFilterItemsRef.current = model.items as GridFilterItem[];
committedLogicOperatorRef.current = model.logicOperator;

// Also update the local filterModel so the UI stays in sync
setFilterModel({
items: model.items,
logicOperator: model.logicOperator,
quickFilterValues: model.quickFilterValues ?? [],
quickFilterLogicOperator: model.quickFilterLogicOperator,
});
setPaginationModel((prev) => ({ ...prev, page: 0 }));
};
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.

2 participants