Skip to content

Commit

Permalink
Update the logic for comparing values with the initial values (#454)
Browse files Browse the repository at this point in the history
* compare values with initial updated

* isUpdated updated(revert) with for

* Update CHANGELOG.md

---------

Co-authored-by: Mikhail Volkov <mikhail@volkovlabs.io>
  • Loading branch information
vitPinchuk and mikhail-vl authored Jul 16, 2024
1 parent bedffc0 commit a3d79cf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- Updated Docker Compose and E2E pipeline (#446, #447)
- Improved unit tests (#447)
- Updated Business Forms tutorial (#451)
- Updated the logic for comparing values with the initial values (#454)

## 4.1.0 (2024-07-09)

Expand Down
3 changes: 2 additions & 1 deletion src/components/FormPanel/FormPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
toDataQueryResponse,
} from '@grafana/runtime';
import { Alert, Button, ButtonGroup, ConfirmModal, usePanelContext, useStyles2, useTheme2 } from '@grafana/ui';
import { isEqual } from 'lodash';
import React, { useCallback, useEffect, useMemo, useState } from 'react';

import {
Expand Down Expand Up @@ -773,7 +774,7 @@ export const FormPanel: React.FC<Props> = ({
*/
const isUpdated = useMemo(() => {
for (const element of elements) {
if (element.value !== initial[element.id]) {
if (!isEqual(initial[element.id], element.value)) {
return true;
}
}
Expand Down

0 comments on commit a3d79cf

Please sign in to comment.