@astral/mobx-query 1.10.1 → 1.10.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.
@@ -76,6 +76,7 @@ export class AuxiliaryQuery {
76
76
  */
77
77
  this.submitError = (error) => {
78
78
  this.checkBackgroundAndSet((storage) => this.setError(storage, error));
79
+ this.isInvalid = false;
79
80
  };
80
81
  this.setLoading = (storage) => {
81
82
  storage.isLoading = true;
@@ -16,6 +16,7 @@ export declare class DataStorage<TData> {
16
16
  * Метод для установки данных
17
17
  */
18
18
  setData: (value: TData) => void;
19
+ cleanData: () => void;
19
20
  /**
20
21
  * Геттер данных
21
22
  */
@@ -15,6 +15,9 @@ export class DataStorage {
15
15
  this.setData = (value) => {
16
16
  this.internalData = value;
17
17
  };
18
+ this.cleanData = () => {
19
+ this.internalData = undefined;
20
+ };
18
21
  makeAutoObservable(this);
19
22
  }
20
23
  /**
@@ -92,6 +92,9 @@ export class InfiniteQuery extends QueryContainer {
92
92
  })
93
93
  .catch((e) => {
94
94
  var _a;
95
+ if (!this.background) {
96
+ this.storage.cleanData();
97
+ }
95
98
  if (onError) {
96
99
  onError(e);
97
100
  }
package/Query/Query.js CHANGED
@@ -53,6 +53,9 @@ export class Query extends QueryContainer {
53
53
  })
54
54
  .catch((e) => {
55
55
  var _a;
56
+ if (!this.background) {
57
+ this.storage.cleanData();
58
+ }
56
59
  if (onError) {
57
60
  onError(e);
58
61
  }
@@ -79,6 +79,7 @@ class AuxiliaryQuery {
79
79
  */
80
80
  this.submitError = (error) => {
81
81
  this.checkBackgroundAndSet((storage) => this.setError(storage, error));
82
+ this.isInvalid = false;
82
83
  };
83
84
  this.setLoading = (storage) => {
84
85
  storage.isLoading = true;
@@ -16,6 +16,7 @@ export declare class DataStorage<TData> {
16
16
  * Метод для установки данных
17
17
  */
18
18
  setData: (value: TData) => void;
19
+ cleanData: () => void;
19
20
  /**
20
21
  * Геттер данных
21
22
  */
@@ -18,6 +18,9 @@ class DataStorage {
18
18
  this.setData = (value) => {
19
19
  this.internalData = value;
20
20
  };
21
+ this.cleanData = () => {
22
+ this.internalData = undefined;
23
+ };
21
24
  (0, mobx_1.makeAutoObservable)(this);
22
25
  }
23
26
  /**
@@ -95,6 +95,9 @@ class InfiniteQuery extends QueryContainer_1.QueryContainer {
95
95
  })
96
96
  .catch((e) => {
97
97
  var _a;
98
+ if (!this.background) {
99
+ this.storage.cleanData();
100
+ }
98
101
  if (onError) {
99
102
  onError(e);
100
103
  }
@@ -56,6 +56,9 @@ class Query extends QueryContainer_1.QueryContainer {
56
56
  })
57
57
  .catch((e) => {
58
58
  var _a;
59
+ if (!this.background) {
60
+ this.storage.cleanData();
61
+ }
59
62
  if (onError) {
60
63
  onError(e);
61
64
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astral/mobx-query",
3
- "version": "1.10.1",
3
+ "version": "1.10.2",
4
4
  "browser": "./index.js",
5
5
  "main": "./node/index.js",
6
6
  "dependencies": {