@ethlete/query 5.43.1 → 5.44.1

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,23 @@
1
1
  # @ethlete/query
2
2
 
3
+ ## 5.44.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`2c02096`](https://github.com/ethlete-io/ethdk/commit/2c020964d1b57ebaa483035be59ee84a15d1794e) Thanks [@TomTomB](https://github.com/TomTomB)! - Give each object in an array its own index when `writeArrayIndexes` is enabled. Before, every object item was serialized at index `0`.
8
+
9
+ ## 5.44.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`8d2efef`](https://github.com/ethlete-io/ethdk/commit/8d2efef2a367db82d44977a3fdfe56396bb46515) Thanks [@TomTomB](https://github.com/TomTomB)! - Minor bump only
14
+
15
+ ## 5.43.2
16
+
17
+ ### Patch Changes
18
+
19
+ - [`830b987`](https://github.com/ethlete-io/ethdk/commit/830b987eba43a51252c3c55eee5590ceef8bf1cb) Thanks [@TomTomB](https://github.com/TomTomB)! - Fix query v3 features not reacting to 204 responses due to null checks
20
+
3
21
  ## 5.43.1
4
22
 
5
23
  ### Patch Changes
@@ -140,21 +140,24 @@ const buildQueryString = (params, config) => {
140
140
  }
141
141
  else if (Array.isArray(value)) {
142
142
  let currentFilteredIndex = 0;
143
+ let didAddAnyValue = false;
143
144
  for (const arrayValue of value) {
144
145
  const nestedKey = writeArrayIndexes ? `${key}[${currentFilteredIndex}]` : `${key}[]`;
145
146
  const didAddValue = processValue(nestedKey, arrayValue);
146
147
  if (didAddValue) {
147
148
  currentFilteredIndex++;
149
+ didAddAnyValue = true;
148
150
  }
149
151
  }
150
- return null;
152
+ return didAddAnyValue;
151
153
  }
152
154
  else if (typeof value === 'object' && value !== null) {
155
+ let didAddAnyValue = false;
153
156
  for (const [objKey, val] of Object.entries(value)) {
154
157
  const nestedKey = objectNotation === 'dot' ? `${key}.${objKey}` : `${key}[${objKey}]`;
155
- processValue(nestedKey, val);
158
+ didAddAnyValue = processValue(nestedKey, val) || didAddAnyValue;
156
159
  }
157
- return null;
160
+ return didAddAnyValue;
158
161
  }
159
162
  else {
160
163
  if (ignoredValues.includes(value)) {
@@ -1547,11 +1550,11 @@ const withSuccessHandling = (options) => {
1547
1550
  type: QueryFeatureType.WITH_SUCCESS_HANDLING,
1548
1551
  fn: (context) => {
1549
1552
  nestedEffect(() => {
1550
- const response = context.state.response();
1551
- if (response === null)
1553
+ const event = context.state.latestHttpEvent();
1554
+ if (!event || event.type !== HttpEventType.Response)
1552
1555
  return;
1553
1556
  untracked(() => {
1554
- options.handler(response);
1557
+ options.handler(context.state.response());
1555
1558
  });
1556
1559
  }, { injector: context.deps.injector });
1557
1560
  },
@@ -1684,7 +1687,8 @@ const createQuerySnapshotFn = (options) => {
1684
1687
  snapshotState.response.set(currentResponse);
1685
1688
  if (currentLoading)
1686
1689
  return;
1687
- if (!currentResponse && !currentError)
1690
+ const hasCompletedResponse = currentLatestHttpEvent?.type === HttpEventType.Response;
1691
+ if (!hasCompletedResponse && !currentError)
1688
1692
  return;
1689
1693
  // kill the effect once loading is done and we either have a response or an error
1690
1694
  killEffectRef.destroy();
@@ -2084,7 +2088,6 @@ const createHttpRequest = (options) => {
2084
2088
  return true;
2085
2089
  };
2086
2090
  const updateState = (event) => {
2087
- currentEvent.set(event);
2088
2091
  switch (event.type) {
2089
2092
  case HttpEventType.Response:
2090
2093
  {
@@ -2111,6 +2114,7 @@ const createHttpRequest = (options) => {
2111
2114
  }
2112
2115
  break;
2113
2116
  }
2117
+ currentEvent.set(event);
2114
2118
  };
2115
2119
  const updateErrorState = (errorResponse) => {
2116
2120
  const errorRes = createQueryErrorResponse(errorResponse);