fix: Delete freshly created recent Check-ins#12879
Conversation
…ion (internetarchive#12417) When a check-in is created and immediately deleted without refreshing the page, the DELETE request was sent to /check-ins/ with no ID, resulting in a 404. The POST response body containing the new event id was never parsed, so checkInForm.eventId remained null. Fix by awaiting resp.json() in both submit-check-in handlers and calling setEventId() with the returned id. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
for more information, see https://pre-commit.ci
…ck-in (internetarchive#12417) Verify that the event id returned by the server after a successful POST is stored via setEventId() in both the prompt and form submit-check-in handlers, enabling same-page deletion without a page refresh. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
| <input type="hidden" name="edition_key" value=""> | ||
| <div class="check-in__inputs"> | ||
| <label class="check-in__year-label">Year:</label> | ||
| <select class="check-in__select" name="year"> |
There was a problem hiding this comment.
WCAG 4.1.2: Form element has no accessible label.
Form elements must have labels. Use <label>, aria-label, or aria-labelledby.
Details
name: "year"
Every form input needs an accessible label so users understand what information to enter. Use a <label> element with a for attribute matching the input's id, wrap the input in a <label>, or use aria-label/aria-labelledby for custom components. Placeholders are not sufficient as labels since they disappear when typing.
for more information, see https://pre-commit.ci
| <input type="hidden" name="edition_key" value=""> | ||
| <div class="check-in__inputs"> | ||
| <label class="check-in__year-label">Year:</label> | ||
| <select class="check-in__select" name="year"> |
There was a problem hiding this comment.
WCAG 4.1.2: Form element has no accessible label.
Form elements must have labels. Use <label>, aria-label, or aria-labelledby.
Details
name: "year"
Every form input needs an accessible label so users understand what information to enter. Use a <label> element with a for attribute matching the input's id, wrap the input in a <label>, or use aria-label/aria-labelledby for custom components. Placeholders are not sufficient as labels since they disappear when typing.
2026-06-08.4.30.15.movHere is a video demonstrating the fix working locally. |
|
@RayBB let me know if you have bandwidth for this one otherwise I am happy to take it! |
| <input type="hidden" name="edition_key" value=""> | ||
| <div class="check-in__inputs"> | ||
| <label class="check-in__year-label">Year:</label> | ||
| <select class="check-in__select" name="year"> |
There was a problem hiding this comment.
WCAG 4.1.2: Form element has no accessible label.
Form elements must have labels. Use <label>, aria-label, or aria-labelledby.
Details
name: "year"
Every form input needs an accessible label so users understand what information to enter. Use a <label> element with a for attribute matching the input's id, wrap the input in a <label>, or use aria-label/aria-labelledby for custom components. Placeholders are not sufficient as labels since they disappear when typing.
| <input type="hidden" name="edition_key" value=""> | ||
| <div class="check-in__inputs"> | ||
| <label class="check-in__year-label">Year:</label> | ||
| <select class="check-in__select" name="year"> |
There was a problem hiding this comment.
WCAG 4.1.2: Form element has no accessible label.
Form elements must have labels. Use <label>, aria-label, or aria-labelledby.
Details
name: "year"
Every form input needs an accessible label so users understand what information to enter. Use a <label> element with a for attribute matching the input's id, wrap the input in a <label>, or use aria-label/aria-labelledby for custom components. Placeholders are not sufficient as labels since they disappear when typing.
RayBB
left a comment
There was a problem hiding this comment.
Working excellently. Thanks for the video and opening the PR for this one. Nice thing to have working better!
Closes #12417
Summary
When a user adds a check-in event and then immediately deletes it without refreshing the page, the DELETE request is sent to
/check-ins/with no ID, resulting in a 404 error.Root cause: Both
submit-check-inevent handlers calledpostCheckIn()and only checkedresp.ok, but never parsed the response body. The FastAPI endpoint returns{ status: "ok", id: <event_id> }on success, but thisidwas never captured — socheckInForm.eventIdremainednulland the subsequent DELETE request had no ID to use.Fix
In both
submit-check-inhandlers insideCheckInComponents.js, parse the JSON response and callsetEventId()with the returnedid:Files changed
openlibrary/plugins/openlibrary/js/my-books/MyBooksDropper/CheckInComponents.jsTesting
Steps to reproduce (before fix):
/check-ins/(no ID) → 404After fix:
/check-ins/<id>→ 200 ✅