@varlet/axle 0.13.0 → 0.13.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/lib/use.cjs CHANGED
@@ -165,9 +165,10 @@ function createUseAxle(options) {
165
165
  let pollingTimer = null;
166
166
  let deactivated = false;
167
167
  let hidden = false;
168
+ let unmounted = false;
168
169
  const run = Object.assign(async (options3 = {}) => {
169
170
  var _a, _b, _c, _d, _e;
170
- if (!runnable()) {
171
+ if (!runnable() || unmounted) {
171
172
  return;
172
173
  }
173
174
  pollingCanceled.value = false;
@@ -289,11 +290,12 @@ function createUseAxle(options) {
289
290
  removeWindowFocusListener();
290
291
  cancelPolling();
291
292
  });
292
- if (abortOnUnmount) {
293
- (0, import_vue4.onUnmounted)(() => {
293
+ (0, import_vue4.onUnmounted)(() => {
294
+ unmounted = true;
295
+ if (abortOnUnmount) {
294
296
  abort();
295
- });
296
- }
297
+ }
298
+ });
297
299
  if (watchOptions) {
298
300
  const normalizedWatchOptions = watchOptions === true ? { params: true, config: true } : __spreadValues({ params: false, config: false }, watchOptions);
299
301
  const enableWatchParams = (0, import_rattail.isFunction)(initialParamsOrGetter) && normalizedWatchOptions.params;
package/lib/use.js CHANGED
@@ -126,9 +126,10 @@ function createUseAxle(options) {
126
126
  let pollingTimer = null;
127
127
  let deactivated = false;
128
128
  let hidden = false;
129
+ let unmounted = false;
129
130
  const run = Object.assign(async (options3 = {}) => {
130
131
  var _a, _b, _c, _d, _e;
131
- if (!runnable()) {
132
+ if (!runnable() || unmounted) {
132
133
  return;
133
134
  }
134
135
  pollingCanceled.value = false;
@@ -250,11 +251,12 @@ function createUseAxle(options) {
250
251
  removeWindowFocusListener();
251
252
  cancelPolling();
252
253
  });
253
- if (abortOnUnmount) {
254
- onUnmounted(() => {
254
+ onUnmounted(() => {
255
+ unmounted = true;
256
+ if (abortOnUnmount) {
255
257
  abort();
256
- });
257
- }
258
+ }
259
+ });
258
260
  if (watchOptions) {
259
261
  const normalizedWatchOptions = watchOptions === true ? { params: true, config: true } : __spreadValues({ params: false, config: false }, watchOptions);
260
262
  const enableWatchParams = isFunction(initialParamsOrGetter) && normalizedWatchOptions.params;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@varlet/axle",
3
- "version": "0.13.0",
3
+ "version": "0.13.1",
4
4
  "description": "Progressive request tool based on axios",
5
5
  "keywords": [
6
6
  "axle",