Skip to content

fix: Delete freshly created recent Check-ins#12879

Merged
RayBB merged 6 commits into
internetarchive:masterfrom
joannajiang711:12417/fix/checkin-delete-missing-id
Jun 17, 2026
Merged

fix: Delete freshly created recent Check-ins#12879
RayBB merged 6 commits into
internetarchive:masterfrom
joannajiang711:12417/fix/checkin-delete-missing-id

Conversation

@joannajiang711

Copy link
Copy Markdown
Contributor

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-in event handlers called postCheckIn() and only checked resp.ok, but never parsed the response body. The FastAPI endpoint returns { status: "ok", id: <event_id> } on success, but this id was never captured — so checkInForm.eventId remained null and the subsequent DELETE request had no ID to use.

Fix

In both submit-check-in handlers inside CheckInComponents.js, parse the JSON response and call setEventId() with the returned id:

.then(async (resp) => {
    if (!resp.ok) {
        throw Error(`Check-in request failed. Status: ${resp.status}`);
    }
    const data = await resp.json();
    if (data.id) {
        this.checkInForm.setEventId(data.id);
    }
    this.updateDateAndShowDisplay(year, month, day);
})

Files changed

  • openlibrary/plugins/openlibrary/js/my-books/MyBooksDropper/CheckInComponents.js

Testing

📹 Video demonstrating the fix working locally will be added before marking ready for review.

Steps to reproduce (before fix):

  1. Go to My Books → Already Read
  2. Open DevTools → Network tab
  3. Click "Today" to add a read date (without refreshing)
  4. Immediately click Delete
  5. Observe: DELETE request sent to /check-ins/ (no ID) → 404

After fix:

  • DELETE request correctly sent to /check-ins/<id> → 200 ✅

jojo112628 and others added 3 commits June 8, 2026 15:03
…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>
…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>

@accesslint accesslint Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found 2 issues across 1 rule.

<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">

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@accesslint accesslint Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found 2 issues across 1 rule.

<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">

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@joannajiang711

Copy link
Copy Markdown
Contributor Author
2026-06-08.4.30.15.mov

Here is a video demonstrating the fix working locally.

@joannajiang711 joannajiang711 marked this pull request as ready for review June 8, 2026 23:34
@github-actions github-actions Bot added the Needs: Response Issues which require feedback from lead label Jun 9, 2026
@mekarpeles mekarpeles changed the title fix: store returned event id after check-in to enable same-page deletion fix: Delete freshly created recent Check-ins Jun 15, 2026
@mekarpeles mekarpeles assigned mekarpeles and RayBB and unassigned mekarpeles Jun 15, 2026
@github-project-automation github-project-automation Bot moved this to Waiting Review/Merge from Staff in Ray's Project Jun 15, 2026
@mekarpeles

Copy link
Copy Markdown
Member

@RayBB let me know if you have bandwidth for this one otherwise I am happy to take it!

@accesslint accesslint Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found 2 issues across 1 rule.

<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">

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@accesslint accesslint Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found 2 issues across 1 rule.

<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">

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 RayBB left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working excellently. Thanks for the video and opening the PR for this one. Nice thing to have working better!

@RayBB RayBB merged commit ea3ae58 into internetarchive:master Jun 17, 2026
4 checks passed
@github-project-automation github-project-automation Bot moved this from Waiting Review/Merge from Staff to Done in Ray's Project Jun 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs: Response Issues which require feedback from lead

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Deleting check-in event errors if just added

4 participants