tsdf 12.6.1 → 12.6.2

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/dist/main.cjs CHANGED
@@ -50,7 +50,7 @@ function createFetchOrquestrator({
50
50
  let mutationIsInProgress = false;
51
51
  let lastFetchStartTime = 0;
52
52
  let lastFetchDuration = 0;
53
- let onMutationEnd = [];
53
+ let onMutationEnd = null;
54
54
  let lastFetchWasAborted = false;
55
55
  let abortFetchsBeforeOrEqual = 0;
56
56
  function setLastFetchDurantion(duration) {
@@ -78,9 +78,9 @@ function createFetchOrquestrator({
78
78
  function endMutation(id) {
79
79
  if (id === lastMutationIdStarted) {
80
80
  mutationIsInProgress = false;
81
- if (onMutationEnd.length > 0) {
82
- onMutationEnd.forEach((cb) => cb());
83
- onMutationEnd = [];
81
+ if (onMutationEnd) {
82
+ onMutationEnd();
83
+ onMutationEnd = null;
84
84
  }
85
85
  flushScheduledFetch();
86
86
  return true;
@@ -222,13 +222,13 @@ function createFetchOrquestrator({
222
222
  };
223
223
  return true;
224
224
  } else if (mutationIsInProgress) {
225
- onMutationEnd.push(() => {
225
+ onMutationEnd = () => {
226
226
  const added = addDelayedRTU(Date.now(), params);
227
227
  if (!added) {
228
228
  on?.("scheduled-rt-fetch-started");
229
229
  scheduleFetch("highPriority", params);
230
230
  }
231
- });
231
+ };
232
232
  return true;
233
233
  } else {
234
234
  if (!addDelayedRTU(startTime, params)) {
package/dist/main.js CHANGED
@@ -21,7 +21,7 @@ function createFetchOrquestrator({
21
21
  let mutationIsInProgress = false;
22
22
  let lastFetchStartTime = 0;
23
23
  let lastFetchDuration = 0;
24
- let onMutationEnd = [];
24
+ let onMutationEnd = null;
25
25
  let lastFetchWasAborted = false;
26
26
  let abortFetchsBeforeOrEqual = 0;
27
27
  function setLastFetchDurantion(duration) {
@@ -49,9 +49,9 @@ function createFetchOrquestrator({
49
49
  function endMutation(id) {
50
50
  if (id === lastMutationIdStarted) {
51
51
  mutationIsInProgress = false;
52
- if (onMutationEnd.length > 0) {
53
- onMutationEnd.forEach((cb) => cb());
54
- onMutationEnd = [];
52
+ if (onMutationEnd) {
53
+ onMutationEnd();
54
+ onMutationEnd = null;
55
55
  }
56
56
  flushScheduledFetch();
57
57
  return true;
@@ -193,13 +193,13 @@ function createFetchOrquestrator({
193
193
  };
194
194
  return true;
195
195
  } else if (mutationIsInProgress) {
196
- onMutationEnd.push(() => {
196
+ onMutationEnd = () => {
197
197
  const added = addDelayedRTU(Date.now(), params);
198
198
  if (!added) {
199
199
  on?.("scheduled-rt-fetch-started");
200
200
  scheduleFetch("highPriority", params);
201
201
  }
202
- });
202
+ };
203
203
  return true;
204
204
  } else {
205
205
  if (!addDelayedRTU(startTime, params)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tsdf",
3
- "version": "12.6.1",
3
+ "version": "12.6.2",
4
4
  "description": "A data fetching solution based on t-state",
5
5
  "license": "MIT",
6
6
  "author": "Lucas Santos",