-
Notifications
You must be signed in to change notification settings - Fork 38
🐛 fix(web-e2e): close the last 9 gaps — playwright suite 36/36 on web #2537
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: development
Are you sure you want to change the base?
Changes from all commits
1a7924e
fadfe11
3230625
c486fe9
a3861d3
27ebe83
30ab72b
aa25db4
54c5d56
65bb942
3d15337
4808c3a
5fca3ff
b803cc8
32f45ec
e35e18b
e7c1108
bedf863
03c45d4
09c7cdd
7bf99ad
bfeb63f
c30dd4b
333e207
b807776
46ed531
060b46c
93286d3
31999a4
1fb3e85
a5f7620
b5611db
8f42c6f
820374a
7db46f1
d81df36
ae5e815
9f9b8ac
6380dca
beedbd1
033246e
02fe6fb
37e3447
5edea59
839b484
418817e
aa534d5
0648f97
812fd90
f358a58
fa94f67
8fd42f9
9eb14aa
b732454
ddf005f
a490672
e6fe8b0
19808f1
2b684d0
a2079f8
acd5cb4
194b1da
b3696b2
44ec618
96c3783
eb4a368
cacb3f7
48815c4
f2723d9
62e108d
ab6328e
006bcdd
522c805
db3c627
d93a23e
ab29080
206e6ba
f877822
7b23e15
c17727c
0b7732a
c760b79
51e183b
30fc510
363bac7
152d8f6
b909b88
eca6d2a
4f282d5
274175b
d91ee42
226bb1c
0c3909c
164256f
39c2c20
751c5ef
9b11b51
b3a5856
f7d5060
e37e97e
5a3006d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -6,20 +6,33 @@ import { useCallback } from 'react'; | |||||||||||||
|
|
||||||||||||||
| export function useDeleteTrip() { | ||||||||||||||
| const deleteTrip = useCallback(async (id: string) => { | ||||||||||||||
| // Optimistically mark as deleted in the local store so the UI updates immediately | ||||||||||||||
| // Optimistic local flip so the UI hides the trip immediately. | ||||||||||||||
| const tripObs = obs({ store: tripsStore, id }); | ||||||||||||||
| if (tripObs) { | ||||||||||||||
| tripObs.deleted.set(true); | ||||||||||||||
| } | ||||||||||||||
| // Hard-delete on the server so the list GET won't return the trip on any subsequent reload | ||||||||||||||
| const { error } = await apiClient.trips({ tripId: id }).delete(); | ||||||||||||||
| if (error) { | ||||||||||||||
| const err = new Error(String(error.value ?? 'Failed to delete trip')); | ||||||||||||||
| Sentry.captureException(err, { | ||||||||||||||
| tags: { feature: 'trips', action: 'deleteTrip' }, | ||||||||||||||
| extra: { tripId: id, apiError: error.value, httpStatus: error.status }, | ||||||||||||||
| if (tripObs) tripObs.deleted.set(true); | ||||||||||||||
|
|
||||||||||||||
| Sentry.addBreadcrumb({ | ||||||||||||||
| category: 'trips', | ||||||||||||||
| message: 'Deleting trip', | ||||||||||||||
| level: 'info', | ||||||||||||||
| data: { tripId: id }, | ||||||||||||||
| }); | ||||||||||||||
|
|
||||||||||||||
| // Two failure modes: a transport rejection (network drop, fetch abort) | ||||||||||||||
| // and a non-2xx response (server still has the trip). In both we need | ||||||||||||||
| // to undo the optimistic flip, capture, and rethrow so the caller can | ||||||||||||||
| // surface it. 404 is treated as success since the trip is already gone. | ||||||||||||||
| try { | ||||||||||||||
| const response = await apiClient.trips({ tripId: id }).delete(); | ||||||||||||||
| if (response.error && response.status !== 404) { | ||||||||||||||
| throw new Error(`Trip delete failed (${response.status})`); | ||||||||||||||
| } | ||||||||||||||
|
Comment on lines
+26
to
+28
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't wrap the API error in a new Error before capturing to Sentry. Line 27 throws As per coding guidelines: "Never wrap the original error in 🛡️ Proposed fix try {
const response = await apiClient.trips({ tripId: id }).delete();
if (response.error && response.status !== 404) {
- throw new Error(`Trip delete failed (${response.status})`);
+ throw response.error;
}
} catch (error) {📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||
| } catch (error) { | ||||||||||||||
| if (tripObs) tripObs.deleted.set(false); | ||||||||||||||
| Sentry.captureException(error, { | ||||||||||||||
| tags: { feature: 'trips', action: 'delete' }, | ||||||||||||||
| extra: { tripId: id }, | ||||||||||||||
| }); | ||||||||||||||
| throw err; | ||||||||||||||
| throw error; | ||||||||||||||
| } | ||||||||||||||
| }, []); | ||||||||||||||
|
coderabbitai[bot] marked this conversation as resolved.
|
||||||||||||||
|
|
||||||||||||||
|
|
||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.