Skip to content

Commit e5ea6d8

Browse files
committed
withQueryModels: resave settings when loading without filters
1 parent 6e950c0 commit e5ea6d8

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

packages/components/releaseNotes/components.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ Components, models, actions, and utility functions for LabKey applications and p
1111
- Remove SampleGridButtonProps
1212
- Remove SamplesTabbedGridPanelComponentProps
1313
- Remove EditableGridLoaderFromSelection
14+
- withQueryModels: resave settings when loading without filters
15+
- This prevents unexpected grid state in our apps when navigating after creating and editing rows
1416

1517
### version 6.50.0
1618
*Released*: 18 June 2025

packages/components/src/public/QueryModel/withQueryModels.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,17 @@ function applySavedSettings(id: string, model: QueryModel): QueryModel {
258258
}
259259
}
260260

261-
return model.mutate(mutations as Partial<QueryModel>);
261+
const modelWithSavedSettings = model.mutate(mutations as Partial<QueryModel>);
262+
263+
if (model.useSavedSettings === SavedSettings.noFilters) {
264+
// If we're retrieving saved settings, but ignoring filters, we need to resave the settings without the
265+
// filters or app behavior will be confusing. For example: you create a sample, and are navigated to a grid
266+
// with no filters, then you edit a sample on that grid. When you navigate back, after editing, the filter
267+
// that was removed after creation is now back.
268+
saveSettingsToLocalStorage(modelWithSavedSettings);
269+
}
270+
271+
return modelWithSavedSettings;
262272
}
263273
return model;
264274
}

0 commit comments

Comments
 (0)