@ethlete/query 6.0.0-next.2 → 6.0.0-next.4

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,17 @@
1
1
  # @ethlete/query
2
2
 
3
+ ## 6.0.0-next.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [#2958](https://github.com/ethlete-io/ethdk/pull/2958) [`8ecdfc0`](https://github.com/ethlete-io/ethdk/commit/8ecdfc00d785b0b535601b5d95ca7e2cd55455b6) Thanks [@github-actions](https://github.com/apps/github-actions)! - Update v3 migration to reflect latest api changes
8
+
9
+ ## 6.0.0-next.3
10
+
11
+ ### Patch Changes
12
+
13
+ - [#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
14
+
3
15
  ## 6.0.0-next.2
4
16
 
5
17
  ### Minor Changes
@@ -5665,6 +5665,8 @@ const createBearerAuthProviderImpl = (config) => {
5665
5665
  accessToken.set(null);
5666
5666
  refreshToken.set(null);
5667
5667
  queryClient.repository.unbindAllSecure();
5668
+ latestExecutedQuery.set(null);
5669
+ latestNonInternalQuery.set(null);
5668
5670
  };
5669
5671
  const isLeader = createLeaderElection(config);
5670
5672
  const querySetupContext = {
@@ -7022,8 +7024,11 @@ class QueryForm {
7022
7024
  continue;
7023
7025
  const valueGotRemoved = value === ET_PROPERTY_REMOVED;
7024
7026
  if (valueGotRemoved) {
7025
- field.control.setValue(this._getDefaultValue(key), { emitEvent: false });
7026
- didValueChanges = true;
7027
+ const defaultValue = this._getDefaultValue(key);
7028
+ if (!equal(field.control.value, defaultValue)) {
7029
+ field.control.setValue(defaultValue, { emitEvent: false });
7030
+ didValueChanges = true;
7031
+ }
7027
7032
  continue;
7028
7033
  }
7029
7034
  let deserializedValue = value;
@@ -7195,6 +7200,21 @@ class QueryForm {
7195
7200
  });
7196
7201
  }
7197
7202
  _handleFormChange(forceOverwrite = false) {
7203
+ // Normalize values that have a valueToQueryParamTransformFn returning null/undefined to their
7204
+ // field default before capturing the new value. This prevents intermediate "empty object" states
7205
+ // (e.g. Sort emitting { active: '', direction: '' } when cleared) from being
7206
+ // emitted as distinct form values.
7207
+ for (const [key, field] of Object.entries(this._fields)) {
7208
+ if (!field.data.valueToQueryParamTransformFn)
7209
+ continue;
7210
+ const rawValue = this._formValue[key];
7211
+ if (this._isDefaultValue(key, rawValue))
7212
+ continue;
7213
+ const serialized = field.data.valueToQueryParamTransformFn(rawValue);
7214
+ if (serialized !== null && serialized !== undefined)
7215
+ continue;
7216
+ this.form.controls[key]?.setValue(this._getDefaultValue(key), { emitEvent: false });
7217
+ }
7198
7218
  const currentVal = clone(this._currentFormValue$.value);
7199
7219
  const newVal = clone(this._formValue);
7200
7220
  if (equal(currentVal, newVal)) {