sprintify-ui 0.10.48 → 0.10.49
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/sprintify-ui.es.js +927 -914
- package/package.json +1 -1
- package/src/components/BaseBelongsToFetch.vue +29 -5
package/package.json
CHANGED
|
@@ -49,7 +49,7 @@ import { config } from '@/index';
|
|
|
49
49
|
import BaseAutocompleteFetch from './BaseAutocompleteFetch.vue';
|
|
50
50
|
import { RawOption, SelectConfiguration } from '@/types';
|
|
51
51
|
import { Size } from '@/utils/sizes';
|
|
52
|
-
import { debounce, isObject } from 'lodash';
|
|
52
|
+
import { debounce, isObject, uniqueId } from 'lodash';
|
|
53
53
|
|
|
54
54
|
const props = withDefaults(
|
|
55
55
|
defineProps<{
|
|
@@ -107,19 +107,20 @@ const autocompleteFetch = ref<InstanceType<
|
|
|
107
107
|
> | null>(null);
|
|
108
108
|
|
|
109
109
|
const model = ref<RawOption | null>(null);
|
|
110
|
-
|
|
110
|
+
|
|
111
|
+
const ensureModelIsFilledWithRouteDebounced = debounce(ensureModelIsFilledWithRoute, 50);
|
|
111
112
|
|
|
112
113
|
watch(
|
|
113
114
|
() => props.currentModel,
|
|
114
|
-
|
|
115
|
+
ensureModelIsFilled,
|
|
115
116
|
);
|
|
116
117
|
|
|
117
118
|
watch(
|
|
118
119
|
() => props.modelValue,
|
|
119
|
-
|
|
120
|
+
ensureModelIsFilled,
|
|
120
121
|
);
|
|
121
122
|
|
|
122
|
-
|
|
123
|
+
ensureModelIsFilled();
|
|
123
124
|
|
|
124
125
|
function onUpdate(newModel: RawOption | null) {
|
|
125
126
|
if (!newModel) {
|
|
@@ -157,10 +158,33 @@ function ensureModelIsFilled() {
|
|
|
157
158
|
return;
|
|
158
159
|
}
|
|
159
160
|
|
|
161
|
+
ensureModelIsFilledWithRouteDebounced();
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
let ensureModelIsFilledWithRouteLastId = null as string | number | null;
|
|
166
|
+
|
|
167
|
+
function ensureModelIsFilledWithRoute() {
|
|
168
|
+
if (props.modelValue == null) {
|
|
169
|
+
model.value = null;
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if (props.showRouteUrl == null) {
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
const ensureModelIsFilledWithRouteCurrentId = uniqueId();
|
|
178
|
+
ensureModelIsFilledWithRouteLastId = ensureModelIsFilledWithRouteCurrentId;
|
|
179
|
+
|
|
160
180
|
http
|
|
161
181
|
.get(props.showRouteUrl(props.modelValue))
|
|
162
182
|
.then((response: AxiosResponse) => {
|
|
163
183
|
|
|
184
|
+
if (ensureModelIsFilledWithRouteLastId !== ensureModelIsFilledWithRouteCurrentId) {
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
|
|
164
188
|
const data = response.data as Record<string, unknown>;
|
|
165
189
|
|
|
166
190
|
if (!isObject(data)) {
|