Skip to content

Commit d41c5d8

Browse files
authored
Merge changes from release26.1-SNAPSHOT through v7.7.4 (#1924)
### version 7.12.1 *Released*: 14 January 2026 - Merge from release26.1-SNAPSHOT to develop - includes changes from 7.7.4 #1921
1 parent a209591 commit d41c5d8

4 files changed

Lines changed: 27 additions & 8 deletions

File tree

packages/components/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/components/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@labkey/components",
3-
"version": "7.12.0",
3+
"version": "7.12.1",
44
"description": "Components, models, actions, and utility functions for LabKey applications and pages",
55
"sideEffects": false,
66
"files": [

packages/components/releaseNotes/components.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# @labkey/components
22
Components, models, actions, and utility functions for LabKey applications and pages
33

4+
### version 7.12.1
5+
*Released*: 14 January 2026
6+
- Merge from release26.1-SNAPSHOT to develop
7+
- includes changes from 7.7.4 #1921
8+
49
### version 7.12.0
510
*Released*: 7 January 2026
611
- Lineage: add "restricted" property
@@ -33,6 +38,11 @@ Components, models, actions, and utility functions for LabKey applications and p
3338
- Added hasMixedValue prop support across all input components (TextInput, SelectInput, CheckboxInput, DatePickerInput, FileInput, TextAreaInput, AmountUnitInput)
3439
- Updated BulkUpdateForm and BulkAddUpdateForm to pass conflicting fields information to form inputs
3540

41+
### version 7.7.4
42+
*Released*: 8 January 2026
43+
- [GitHub Issue #723](https://github.com/LabKey/internal-issues/issues/723)
44+
- EditableDetailPanel: use `useRouteLeave`
45+
3646
### version 7.7.3
3747
*Released*: 31 December 2025
3848
- [GitHub Issue #495](https://github.com/LabKey/internal-issues/issues/495)

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

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { QueryModel } from './QueryModel';
2222

2323
import { DetailPanel, DetailPanelWithModel } from './DetailPanel';
2424
import { EDIT_METHOD } from '../../internal/constants';
25+
import { useRouteLeave } from '../../internal/util/RouteLeave';
2526

2627
export interface EditableDetailPanelProps {
2728
appEditable?: boolean;
@@ -71,6 +72,7 @@ export const EditableDetailPanel: FC<EditableDetailPanelProps> = props => {
7172
} = props;
7273

7374
const { api } = useAppContext();
75+
const [_, setIsDirty] = useRouteLeave();
7476
const [canSubmit, setCanSubmit] = useState<boolean>(false);
7577
const [editing, setEditing] = useState<boolean>(false);
7678
const [error, setError] = useState<string>(undefined);
@@ -90,10 +92,11 @@ export const EditableDetailPanel: FC<EditableDetailPanelProps> = props => {
9092
const toggleEditing = useCallback((): void => {
9193
const updated = !editing;
9294
setEditing(updated);
95+
setIsDirty(false);
9396
setWarning(undefined);
9497
setError(undefined);
9598
onEditToggle?.(updated);
96-
}, [editing, onEditToggle]);
99+
}, [editing, onEditToggle, setIsDirty]);
97100

98101
const disableSubmitButton = useCallback((): void => {
99102
setCanSubmit(false);
@@ -103,9 +106,13 @@ export const EditableDetailPanel: FC<EditableDetailPanelProps> = props => {
103106
setCanSubmit(true);
104107
}, []);
105108

106-
const handleFormChange = useCallback((): void => {
107-
setWarning(undefined);
108-
}, []);
109+
const handleFormChange = useCallback(
110+
(_: never, isChanged: boolean): void => {
111+
setWarning(undefined);
112+
if (isChanged) setIsDirty(true);
113+
},
114+
[setIsDirty]
115+
);
109116

110117
const fileInputRenderer = useCallback((col: QueryColumn, data: any): ReactNode => {
111118
return <FileInput formsy initialValue={data} name={col.fieldKey} queryColumn={col} showLabel={false} />;
@@ -121,6 +128,7 @@ export const EditableDetailPanel: FC<EditableDetailPanelProps> = props => {
121128
setCanSubmit(false);
122129
setError(undefined);
123130
setWarning('No changes detected. Please update the form and click save.');
131+
setIsDirty(false);
124132
return;
125133
}
126134

@@ -146,6 +154,7 @@ export const EditableDetailPanel: FC<EditableDetailPanelProps> = props => {
146154
auditUserComment: comment,
147155
});
148156

157+
setIsDirty(false);
149158
setEditing(false);
150159
onUpdate?.();
151160
onEditToggle?.(false);
@@ -154,7 +163,7 @@ export const EditableDetailPanel: FC<EditableDetailPanelProps> = props => {
154163
setWarning(undefined);
155164
}
156165
},
157-
[model, onBeforeUpdate, api.query, containerPath, comment, onUpdate, onEditToggle]
166+
[model, onBeforeUpdate, api.query, containerPath, comment, onUpdate, onEditToggle, setIsDirty]
158167
);
159168

160169
const isEditable = !model.isLoading && model.hasRows && (model.queryInfo?.isAppEditable() || appEditable);

0 commit comments

Comments
 (0)