Skip to content
Snippets Groups Projects
Verified Commit efa3cf49 authored by Volker Schukai's avatar Volker Schukai :alien:
Browse files

fix: originValues in the savebutton is now reset.

parent 45ccd213
No related branches found
No related tags found
No related merge requests found
# Changelog
## [3.73.4] - 2024-07-02
### Bug Fixes
- event processing is now only active in selected controls: form, filter. [#224](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/224)
## [3.73.3] - 2024-07-01
### Bug Fixes
......
......@@ -46,6 +46,12 @@ export { SaveButton };
*/
const stateButtonElementSymbol = Symbol("stateButtonElement");
/**
* @private
* @type {symbol}
*/
const originValuesSymbol = Symbol("originValues");
/**
* @private
* @type {symbol}
......@@ -161,18 +167,18 @@ class SaveButton extends CustomElement {
new Observer(handleDataSourceChanges.bind(this)),
);
let originValues;
self[originValuesSymbol] = null;
element.datasource.attachObserver(
new Observer(function () {
if (!originValues) {
originValues = clone(self[datasourceLinkedElementSymbol].data);
if (!self[originValuesSymbol]) {
self[originValuesSymbol] = clone(self[datasourceLinkedElementSymbol].data);
}
const currentValues = this.getRealSubject();
const ignoreChanges = self.getOption("ignoreChanges");
const result = diff(originValues, currentValues);
const result = diff(self[originValuesSymbol], currentValues);
if (isArray(ignoreChanges) && ignoreChanges.length > 0) {
const itemsToRemove = [];
for (const item of result) {
......@@ -285,6 +291,7 @@ function initEventHandler() {
this[datasourceLinkedElementSymbol]
.write()
.then(() => {
this[originValuesSymbol] = null;
this[stateButtonElementSymbol].removeState();
this[stateButtonElementSymbol].setOption("disabled", true);
this.setOption("changes", 0);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment