@ethlete/query 6.0.0-next.2 → 6.0.0-next.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @ethlete/query
|
|
2
2
|
|
|
3
|
+
## 6.0.0-next.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#2926](https://github.com/ethlete-io/ethdk/pull/2926) [`801d112`](https://github.com/ethlete-io/ethdk/commit/801d1122b55d24762b9e656d3a8ed70c561ec06f) Thanks [@github-actions](https://github.com/apps/github-actions)! - Fix query form emitting twice if a sort field gets cleared
|
|
8
|
+
|
|
3
9
|
## 6.0.0-next.2
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
|
@@ -7022,8 +7022,11 @@ class QueryForm {
|
|
|
7022
7022
|
continue;
|
|
7023
7023
|
const valueGotRemoved = value === ET_PROPERTY_REMOVED;
|
|
7024
7024
|
if (valueGotRemoved) {
|
|
7025
|
-
|
|
7026
|
-
|
|
7025
|
+
const defaultValue = this._getDefaultValue(key);
|
|
7026
|
+
if (!equal(field.control.value, defaultValue)) {
|
|
7027
|
+
field.control.setValue(defaultValue, { emitEvent: false });
|
|
7028
|
+
didValueChanges = true;
|
|
7029
|
+
}
|
|
7027
7030
|
continue;
|
|
7028
7031
|
}
|
|
7029
7032
|
let deserializedValue = value;
|
|
@@ -7195,6 +7198,21 @@ class QueryForm {
|
|
|
7195
7198
|
});
|
|
7196
7199
|
}
|
|
7197
7200
|
_handleFormChange(forceOverwrite = false) {
|
|
7201
|
+
// Normalize values that have a valueToQueryParamTransformFn returning null/undefined to their
|
|
7202
|
+
// field default before capturing the new value. This prevents intermediate "empty object" states
|
|
7203
|
+
// (e.g. Sort emitting { active: '', direction: '' } when cleared) from being
|
|
7204
|
+
// emitted as distinct form values.
|
|
7205
|
+
for (const [key, field] of Object.entries(this._fields)) {
|
|
7206
|
+
if (!field.data.valueToQueryParamTransformFn)
|
|
7207
|
+
continue;
|
|
7208
|
+
const rawValue = this._formValue[key];
|
|
7209
|
+
if (this._isDefaultValue(key, rawValue))
|
|
7210
|
+
continue;
|
|
7211
|
+
const serialized = field.data.valueToQueryParamTransformFn(rawValue);
|
|
7212
|
+
if (serialized !== null && serialized !== undefined)
|
|
7213
|
+
continue;
|
|
7214
|
+
this.form.controls[key]?.setValue(this._getDefaultValue(key), { emitEvent: false });
|
|
7215
|
+
}
|
|
7198
7216
|
const currentVal = clone(this._currentFormValue$.value);
|
|
7199
7217
|
const newVal = clone(this._formValue);
|
|
7200
7218
|
if (equal(currentVal, newVal)) {
|