@bbearai/react 0.4.5 → 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 CHANGED
@@ -2329,6 +2329,7 @@ function TestFeedbackScreen({ status, assignmentId, nav }) {
2329
2329
  }
2330
2330
  };
2331
2331
  const handleSubmit = async () => {
2332
+ if (submitting || images.isUploading) return;
2332
2333
  setSubmitting(true);
2333
2334
  if (client && assignment) {
2334
2335
  const screenshotUrls = images.getScreenshotUrls();
@@ -3333,15 +3334,28 @@ function ThreadDetailScreen({
3333
3334
  const [sending, setSending] = (0, import_react10.useState)(false);
3334
3335
  const [sendError, setSendError] = (0, import_react10.useState)(false);
3335
3336
  (0, import_react10.useEffect)(() => {
3337
+ let cancelled = false;
3338
+ setLoading(true);
3336
3339
  (async () => {
3337
- setLoading(true);
3338
- const msgs = await getThreadMessages(thread.id);
3339
- setMessages(msgs);
3340
- setLoading(false);
3341
- if (thread.unreadCount > 0) {
3342
- await markAsRead(thread.id);
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
+ }
3343
3354
  }
3344
3355
  })();
3356
+ return () => {
3357
+ cancelled = true;
3358
+ };
3345
3359
  }, [thread.id]);
3346
3360
  const handleSend = async () => {
3347
3361
  if (!replyText.trim() && replyImages.images.length === 0 || sending || replyImages.isUploading) return;
@@ -3765,6 +3779,7 @@ function ProfileScreen({ nav }) {
3765
3779
  }
3766
3780
  }, [testerInfo]);
3767
3781
  const handleSave = async () => {
3782
+ if (saving) return;
3768
3783
  setSaving(true);
3769
3784
  const updates = {
3770
3785
  name: name.trim(),
@@ -4242,11 +4257,21 @@ function IssueListScreen({ nav, category }) {
4242
4257
  let cancelled = false;
4243
4258
  setLoading(true);
4244
4259
  (async () => {
4245
- if (!client) return;
4246
- const data = await client.getIssues(category);
4247
- if (!cancelled) {
4248
- setIssues(data);
4260
+ if (!client) {
4249
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
+ }
4250
4275
  }
4251
4276
  })();
4252
4277
  return () => {
package/dist/index.mjs CHANGED
@@ -2290,6 +2290,7 @@ function TestFeedbackScreen({ status, assignmentId, nav }) {
2290
2290
  }
2291
2291
  };
2292
2292
  const handleSubmit = async () => {
2293
+ if (submitting || images.isUploading) return;
2293
2294
  setSubmitting(true);
2294
2295
  if (client && assignment) {
2295
2296
  const screenshotUrls = images.getScreenshotUrls();
@@ -3294,15 +3295,28 @@ function ThreadDetailScreen({
3294
3295
  const [sending, setSending] = useState7(false);
3295
3296
  const [sendError, setSendError] = useState7(false);
3296
3297
  useEffect5(() => {
3298
+ let cancelled = false;
3299
+ setLoading(true);
3297
3300
  (async () => {
3298
- setLoading(true);
3299
- const msgs = await getThreadMessages(thread.id);
3300
- setMessages(msgs);
3301
- setLoading(false);
3302
- if (thread.unreadCount > 0) {
3303
- await markAsRead(thread.id);
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
+ }
3304
3315
  }
3305
3316
  })();
3317
+ return () => {
3318
+ cancelled = true;
3319
+ };
3306
3320
  }, [thread.id]);
3307
3321
  const handleSend = async () => {
3308
3322
  if (!replyText.trim() && replyImages.images.length === 0 || sending || replyImages.isUploading) return;
@@ -3726,6 +3740,7 @@ function ProfileScreen({ nav }) {
3726
3740
  }
3727
3741
  }, [testerInfo]);
3728
3742
  const handleSave = async () => {
3743
+ if (saving) return;
3729
3744
  setSaving(true);
3730
3745
  const updates = {
3731
3746
  name: name.trim(),
@@ -4203,11 +4218,21 @@ function IssueListScreen({ nav, category }) {
4203
4218
  let cancelled = false;
4204
4219
  setLoading(true);
4205
4220
  (async () => {
4206
- if (!client) return;
4207
- const data = await client.getIssues(category);
4208
- if (!cancelled) {
4209
- setIssues(data);
4221
+ if (!client) {
4210
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
+ }
4211
4236
  }
4212
4237
  })();
4213
4238
  return () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbearai/react",
3
- "version": "0.4.5",
3
+ "version": "0.4.6",
4
4
  "description": "BugBear React components for web apps",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",