@bbearai/react 0.4.4 → 0.4.6
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/index.js +40 -10
- package/dist/index.mjs +40 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2120,6 +2120,11 @@ function useImageAttachments(uploadFn, maxImages, bucket = "screenshots") {
|
|
|
2120
2120
|
setImages((prev) => prev.map(
|
|
2121
2121
|
(img) => img.id === id ? { ...img, remoteUrl: url, status: url ? "done" : "error" } : img
|
|
2122
2122
|
));
|
|
2123
|
+
}).catch((err) => {
|
|
2124
|
+
console.error("BugBear: Image upload failed", err);
|
|
2125
|
+
setImages((prev) => prev.map(
|
|
2126
|
+
(img) => img.id === id ? { ...img, status: "error" } : img
|
|
2127
|
+
));
|
|
2123
2128
|
});
|
|
2124
2129
|
}
|
|
2125
2130
|
}, [images.length, maxImages, uploadFn, bucket]);
|
|
@@ -2324,6 +2329,7 @@ function TestFeedbackScreen({ status, assignmentId, nav }) {
|
|
|
2324
2329
|
}
|
|
2325
2330
|
};
|
|
2326
2331
|
const handleSubmit = async () => {
|
|
2332
|
+
if (submitting || images.isUploading) return;
|
|
2327
2333
|
setSubmitting(true);
|
|
2328
2334
|
if (client && assignment) {
|
|
2329
2335
|
const screenshotUrls = images.getScreenshotUrls();
|
|
@@ -3328,15 +3334,28 @@ function ThreadDetailScreen({
|
|
|
3328
3334
|
const [sending, setSending] = (0, import_react10.useState)(false);
|
|
3329
3335
|
const [sendError, setSendError] = (0, import_react10.useState)(false);
|
|
3330
3336
|
(0, import_react10.useEffect)(() => {
|
|
3337
|
+
let cancelled = false;
|
|
3338
|
+
setLoading(true);
|
|
3331
3339
|
(async () => {
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3340
|
+
try {
|
|
3341
|
+
const msgs = await getThreadMessages(thread.id);
|
|
3342
|
+
if (!cancelled) {
|
|
3343
|
+
setMessages(msgs);
|
|
3344
|
+
}
|
|
3345
|
+
if (thread.unreadCount > 0) {
|
|
3346
|
+
await markAsRead(thread.id);
|
|
3347
|
+
}
|
|
3348
|
+
} catch (err) {
|
|
3349
|
+
console.error("BugBear: Failed to load thread messages", err);
|
|
3350
|
+
} finally {
|
|
3351
|
+
if (!cancelled) {
|
|
3352
|
+
setLoading(false);
|
|
3353
|
+
}
|
|
3338
3354
|
}
|
|
3339
3355
|
})();
|
|
3356
|
+
return () => {
|
|
3357
|
+
cancelled = true;
|
|
3358
|
+
};
|
|
3340
3359
|
}, [thread.id]);
|
|
3341
3360
|
const handleSend = async () => {
|
|
3342
3361
|
if (!replyText.trim() && replyImages.images.length === 0 || sending || replyImages.isUploading) return;
|
|
@@ -3760,6 +3779,7 @@ function ProfileScreen({ nav }) {
|
|
|
3760
3779
|
}
|
|
3761
3780
|
}, [testerInfo]);
|
|
3762
3781
|
const handleSave = async () => {
|
|
3782
|
+
if (saving) return;
|
|
3763
3783
|
setSaving(true);
|
|
3764
3784
|
const updates = {
|
|
3765
3785
|
name: name.trim(),
|
|
@@ -4237,11 +4257,21 @@ function IssueListScreen({ nav, category }) {
|
|
|
4237
4257
|
let cancelled = false;
|
|
4238
4258
|
setLoading(true);
|
|
4239
4259
|
(async () => {
|
|
4240
|
-
if (!client)
|
|
4241
|
-
const data = await client.getIssues(category);
|
|
4242
|
-
if (!cancelled) {
|
|
4243
|
-
setIssues(data);
|
|
4260
|
+
if (!client) {
|
|
4244
4261
|
setLoading(false);
|
|
4262
|
+
return;
|
|
4263
|
+
}
|
|
4264
|
+
try {
|
|
4265
|
+
const data = await client.getIssues(category);
|
|
4266
|
+
if (!cancelled) {
|
|
4267
|
+
setIssues(data);
|
|
4268
|
+
}
|
|
4269
|
+
} catch (err) {
|
|
4270
|
+
console.error("BugBear: Failed to load issues", err);
|
|
4271
|
+
} finally {
|
|
4272
|
+
if (!cancelled) {
|
|
4273
|
+
setLoading(false);
|
|
4274
|
+
}
|
|
4245
4275
|
}
|
|
4246
4276
|
})();
|
|
4247
4277
|
return () => {
|
package/dist/index.mjs
CHANGED
|
@@ -2081,6 +2081,11 @@ function useImageAttachments(uploadFn, maxImages, bucket = "screenshots") {
|
|
|
2081
2081
|
setImages((prev) => prev.map(
|
|
2082
2082
|
(img) => img.id === id ? { ...img, remoteUrl: url, status: url ? "done" : "error" } : img
|
|
2083
2083
|
));
|
|
2084
|
+
}).catch((err) => {
|
|
2085
|
+
console.error("BugBear: Image upload failed", err);
|
|
2086
|
+
setImages((prev) => prev.map(
|
|
2087
|
+
(img) => img.id === id ? { ...img, status: "error" } : img
|
|
2088
|
+
));
|
|
2084
2089
|
});
|
|
2085
2090
|
}
|
|
2086
2091
|
}, [images.length, maxImages, uploadFn, bucket]);
|
|
@@ -2285,6 +2290,7 @@ function TestFeedbackScreen({ status, assignmentId, nav }) {
|
|
|
2285
2290
|
}
|
|
2286
2291
|
};
|
|
2287
2292
|
const handleSubmit = async () => {
|
|
2293
|
+
if (submitting || images.isUploading) return;
|
|
2288
2294
|
setSubmitting(true);
|
|
2289
2295
|
if (client && assignment) {
|
|
2290
2296
|
const screenshotUrls = images.getScreenshotUrls();
|
|
@@ -3289,15 +3295,28 @@ function ThreadDetailScreen({
|
|
|
3289
3295
|
const [sending, setSending] = useState7(false);
|
|
3290
3296
|
const [sendError, setSendError] = useState7(false);
|
|
3291
3297
|
useEffect5(() => {
|
|
3298
|
+
let cancelled = false;
|
|
3299
|
+
setLoading(true);
|
|
3292
3300
|
(async () => {
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3301
|
+
try {
|
|
3302
|
+
const msgs = await getThreadMessages(thread.id);
|
|
3303
|
+
if (!cancelled) {
|
|
3304
|
+
setMessages(msgs);
|
|
3305
|
+
}
|
|
3306
|
+
if (thread.unreadCount > 0) {
|
|
3307
|
+
await markAsRead(thread.id);
|
|
3308
|
+
}
|
|
3309
|
+
} catch (err) {
|
|
3310
|
+
console.error("BugBear: Failed to load thread messages", err);
|
|
3311
|
+
} finally {
|
|
3312
|
+
if (!cancelled) {
|
|
3313
|
+
setLoading(false);
|
|
3314
|
+
}
|
|
3299
3315
|
}
|
|
3300
3316
|
})();
|
|
3317
|
+
return () => {
|
|
3318
|
+
cancelled = true;
|
|
3319
|
+
};
|
|
3301
3320
|
}, [thread.id]);
|
|
3302
3321
|
const handleSend = async () => {
|
|
3303
3322
|
if (!replyText.trim() && replyImages.images.length === 0 || sending || replyImages.isUploading) return;
|
|
@@ -3721,6 +3740,7 @@ function ProfileScreen({ nav }) {
|
|
|
3721
3740
|
}
|
|
3722
3741
|
}, [testerInfo]);
|
|
3723
3742
|
const handleSave = async () => {
|
|
3743
|
+
if (saving) return;
|
|
3724
3744
|
setSaving(true);
|
|
3725
3745
|
const updates = {
|
|
3726
3746
|
name: name.trim(),
|
|
@@ -4198,11 +4218,21 @@ function IssueListScreen({ nav, category }) {
|
|
|
4198
4218
|
let cancelled = false;
|
|
4199
4219
|
setLoading(true);
|
|
4200
4220
|
(async () => {
|
|
4201
|
-
if (!client)
|
|
4202
|
-
const data = await client.getIssues(category);
|
|
4203
|
-
if (!cancelled) {
|
|
4204
|
-
setIssues(data);
|
|
4221
|
+
if (!client) {
|
|
4205
4222
|
setLoading(false);
|
|
4223
|
+
return;
|
|
4224
|
+
}
|
|
4225
|
+
try {
|
|
4226
|
+
const data = await client.getIssues(category);
|
|
4227
|
+
if (!cancelled) {
|
|
4228
|
+
setIssues(data);
|
|
4229
|
+
}
|
|
4230
|
+
} catch (err) {
|
|
4231
|
+
console.error("BugBear: Failed to load issues", err);
|
|
4232
|
+
} finally {
|
|
4233
|
+
if (!cancelled) {
|
|
4234
|
+
setLoading(false);
|
|
4235
|
+
}
|
|
4206
4236
|
}
|
|
4207
4237
|
})();
|
|
4208
4238
|
return () => {
|