bitboss-ui 3.0.0-beta.3 → 3.0.0-beta.4
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/ai/changelog.json
CHANGED
package/dist/ai/components.json
CHANGED
|
@@ -141,9 +141,20 @@ const onClick = async (event: Event) => {
|
|
|
141
141
|
const falseVal = props.falseValue;
|
|
142
142
|
modelValue.value = isEqual(modelValue.value, trueVal) ? falseVal : trueVal;
|
|
143
143
|
}
|
|
144
|
+
// Call the handler FIRST, then decide. Auto-loading is documented as
|
|
145
|
+
// tracking *async* click handlers, but the counter used to increment before
|
|
146
|
+
// the call, so a plain sync handler still passed through a loading state for
|
|
147
|
+
// one microtask. In isolation that never paints — the flip and Vue's
|
|
148
|
+
// re-render settle in the same drain. In a real app it does: a consumer's
|
|
149
|
+
// sync handler that opened a dialog flickered the spinner on every click,
|
|
150
|
+
// and `disable-auto-loading` was the only cure. A sync handler now never
|
|
151
|
+
// touches the counter at all, so there is no window to catch.
|
|
152
|
+
const result = ((attrs.onClick ?? noop) as (...args: any[]) => any)(event);
|
|
153
|
+
if (!result || typeof result.then !== 'function') return result;
|
|
154
|
+
|
|
144
155
|
internalLoading.value++;
|
|
145
156
|
try {
|
|
146
|
-
await
|
|
157
|
+
return await result;
|
|
147
158
|
} finally {
|
|
148
159
|
// Always release the auto-loading counter, even if the handler rejects,
|
|
149
160
|
// so a failing async onClick doesn't leave the button stuck loading.
|
|
@@ -108,9 +108,11 @@ var N = {
|
|
|
108
108
|
let e = F.trueValue, t = F.falseValue;
|
|
109
109
|
P.value = u(P.value, e) ? t : e;
|
|
110
110
|
}
|
|
111
|
+
let t = (V.onClick ?? l)(e);
|
|
112
|
+
if (!t || typeof t.then != "function") return t;
|
|
111
113
|
G.value++;
|
|
112
114
|
try {
|
|
113
|
-
await
|
|
115
|
+
return await t;
|
|
114
116
|
} finally {
|
|
115
117
|
G.value--;
|
|
116
118
|
}
|