[PR #5158] [MERGED] Emit proper author_updated/added events when updating book media #4446

Closed
opened 2026-04-25 00:19:46 +02:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/advplyr/audiobookshelf/pull/5158
Author: @mikiher
Created: 3/30/2026
Status: Merged
Merged: 3/30/2026
Merged by: @advplyr

Base: masterHead: book-update-author-events


📝 Commits (2)

  • 093124a Emit proper author_updated/added events when updating book media
  • ab3bd6f Update JS docs

📊 Changes

2 files changed (+16 additions, -4 deletions)

View changed files

📝 server/models/Author.js (+4 -3)
📝 server/models/Book.js (+12 -1)

📄 Description

Brief summary

When Adding/Removing an author in Edit Book Details, the proper author_updated/author_added events are not properly emitted by the server, so the authors page open on a different client is not properly updated.

Which issue is fixed?

I don't think there's an issue open for this.

In-depth Description

When adding or removing an author in Book Details and submitting, the server updates/adds/removes the author correctly, and creates/removes the proper bookAuthors table rows. However, it doesn't emit author_added/author_updated socket events (it does emit author_removed). Consequently, listeners to those events (e.g. on the authors page) are not getting called, and the UI doesn't get updated (except author_removed which does get sent correctly).

The fix properly sends the missing socket events.

How have you tested this?

  • Had two browser windows opened side-by-side, one on the homepage, and one on the authors page.
  • Opened Edit Book Details on of the books on the homepage
    • added a new (non-existing) author, submitted
    • added an existing author, submitted
    • removed existing author, submitted
    • removed existing author with 1 book, submitted
    • added 2 authors, submitted
    • removed 2 authors, submitted
  • After each of the submissions, the relevant author card/s on the authors page was automatically added/removed/num-books-updated properly as expected.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/advplyr/audiobookshelf/pull/5158 **Author:** [@mikiher](https://github.com/mikiher) **Created:** 3/30/2026 **Status:** ✅ Merged **Merged:** 3/30/2026 **Merged by:** [@advplyr](https://github.com/advplyr) **Base:** `master` ← **Head:** `book-update-author-events` --- ### 📝 Commits (2) - [`093124a`](https://github.com/advplyr/audiobookshelf/commit/093124aac694fbcb18184f84ecbb8dc8aaca7554) Emit proper author_updated/added events when updating book media - [`ab3bd6f`](https://github.com/advplyr/audiobookshelf/commit/ab3bd6f4a170d7ddf6e50dbeb4e5794f1a011e41) Update JS docs ### 📊 Changes **2 files changed** (+16 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `server/models/Author.js` (+4 -3) 📝 `server/models/Book.js` (+12 -1) </details> ### 📄 Description ## Brief summary When Adding/Removing an author in Edit Book Details, the proper author_updated/author_added events are not properly emitted by the server, so the authors page open on a different client is not properly updated. ## Which issue is fixed? I don't think there's an issue open for this. ## In-depth Description When adding or removing an author in Book Details and submitting, the server updates/adds/removes the author correctly, and creates/removes the proper bookAuthors table rows. However, it doesn't emit `author_added`/`author_updated` socket events (it does emit `author_removed`). Consequently, listeners to those events (e.g. on the authors page) are not getting called, and the UI doesn't get updated (except `author_removed` which does get sent correctly). The fix properly sends the missing socket events. ## How have you tested this? - Had two browser windows opened side-by-side, one on the homepage, and one on the authors page. - Opened Edit Book Details on of the books on the homepage - added a new (non-existing) author, submitted - added an existing author, submitted - removed existing author, submitted - removed existing author with 1 book, submitted - added 2 authors, submitted - removed 2 authors, submitted - After each of the submissions, the relevant author card/s on the authors page was automatically added/removed/num-books-updated properly as expected. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2026-04-25 00:19:46 +02:00
adam closed this issue 2026-04-25 00:19:46 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#4446