sprintify-ui 0.10.20 → 0.10.22
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/package.json
CHANGED
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
|
|
65
65
|
<script lang="ts" setup>
|
|
66
66
|
import { config } from '@/index';
|
|
67
|
-
import { debounce, throttle } from 'lodash';
|
|
67
|
+
import { debounce, throttle, uniqueId } from 'lodash';
|
|
68
68
|
import { PropType } from 'vue';
|
|
69
69
|
import {
|
|
70
70
|
Collection,
|
|
@@ -239,13 +239,12 @@ watch(
|
|
|
239
239
|
}
|
|
240
240
|
);
|
|
241
241
|
|
|
242
|
-
|
|
243
|
-
if (fetching.value) {
|
|
244
|
-
return;
|
|
245
|
-
}
|
|
242
|
+
let requestId = '';
|
|
246
243
|
|
|
244
|
+
async function search() {
|
|
247
245
|
fetching.value = true;
|
|
248
246
|
showLoading.value = true;
|
|
247
|
+
requestId = uniqueId();
|
|
249
248
|
|
|
250
249
|
config.http
|
|
251
250
|
.get(props.url, {
|
|
@@ -255,6 +254,11 @@ function search() {
|
|
|
255
254
|
},
|
|
256
255
|
})
|
|
257
256
|
.then((response: any) => {
|
|
257
|
+
|
|
258
|
+
if (requestId !== requestId) {
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
|
|
258
262
|
data.value = response.data as
|
|
259
263
|
| ResourceCollection
|
|
260
264
|
| PaginatedCollection
|
|
@@ -269,6 +273,11 @@ function search() {
|
|
|
269
273
|
firstSearch.value = true;
|
|
270
274
|
})
|
|
271
275
|
.finally(() => {
|
|
276
|
+
|
|
277
|
+
if (requestId !== requestId) {
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
|
|
272
281
|
fetching.value = false;
|
|
273
282
|
showLoading.value = false;
|
|
274
283
|
});
|
|
@@ -692,14 +692,12 @@ function fetch(force = false, showLoading = true) {
|
|
|
692
692
|
.get(fullUrl)
|
|
693
693
|
.then((response) => {
|
|
694
694
|
data.value = response.data;
|
|
695
|
-
loading.value = false;
|
|
696
695
|
error.value = false;
|
|
697
696
|
firstLoad.value = true;
|
|
698
697
|
emit('fetch', data.value);
|
|
699
698
|
})
|
|
700
699
|
.catch(() => {
|
|
701
700
|
data.value = null;
|
|
702
|
-
loading.value = false;
|
|
703
701
|
error.value = true;
|
|
704
702
|
})
|
|
705
703
|
.finally(() => {
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
</template>
|
|
59
59
|
|
|
60
60
|
<script lang="ts" setup>
|
|
61
|
-
import { debounce, throttle } from 'lodash';
|
|
61
|
+
import { debounce, throttle, uniqueId } from 'lodash';
|
|
62
62
|
import { config } from '@/index';
|
|
63
63
|
import { PropType } from 'vue';
|
|
64
64
|
import {
|
|
@@ -175,15 +175,16 @@ watch(
|
|
|
175
175
|
}
|
|
176
176
|
);
|
|
177
177
|
|
|
178
|
+
let requestId = '';
|
|
179
|
+
|
|
178
180
|
const search = () => {
|
|
179
|
-
if (fetching.value) {
|
|
180
|
-
return;
|
|
181
|
-
}
|
|
182
181
|
|
|
183
182
|
fetching.value = true;
|
|
184
183
|
showLoading.value = true;
|
|
185
184
|
firstSearch.value = true;
|
|
186
185
|
|
|
186
|
+
requestId = uniqueId();
|
|
187
|
+
|
|
187
188
|
http
|
|
188
189
|
.get(props.url, {
|
|
189
190
|
params: {
|
|
@@ -192,6 +193,11 @@ const search = () => {
|
|
|
192
193
|
},
|
|
193
194
|
})
|
|
194
195
|
.then((response: any) => {
|
|
196
|
+
|
|
197
|
+
if (requestId != requestId) {
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
|
|
195
201
|
data.value = response.data as
|
|
196
202
|
| ResourceCollection
|
|
197
203
|
| PaginatedCollection
|
|
@@ -206,6 +212,11 @@ const search = () => {
|
|
|
206
212
|
firstSearch.value = true;
|
|
207
213
|
})
|
|
208
214
|
.finally(() => {
|
|
215
|
+
|
|
216
|
+
if (requestId != requestId) {
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
|
|
209
220
|
fetching.value = false;
|
|
210
221
|
showLoading.value = false;
|
|
211
222
|
});
|