[PR #4636] [MERGED] Fix: MultiSelect causes web client to become unresponsive if duplicate keys exist #4308

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

📋 Pull Request Information

Original PR: https://github.com/advplyr/audiobookshelf/pull/4636
Author: @nichwall
Created: 8/30/2025
Status: Merged
Merged: 9/3/2025
Merged by: @advplyr

Base: masterHead: multiselect_duplicate_entries


📝 Commits (2)

  • afab429 Fix: ensure all keys are unique in MultiSelect
  • ba7160c Add index to removeItem on multiselect keydown

📊 Changes

1 file changed (+6 additions, -4 deletions)

View changed files

📝 client/components/ui/MultiSelect.vue (+6 -4)

📄 Description

Brief summary

This PR adds a unique identifier to the Vue for loop to ensure all keys have a unique identifier.

Which issue is fixed?

Related to https://github.com/advplyr/audiobookshelf/issues/4634

In-depth Description

If the same key exists multiple times in a MultiSelect component, the unique key requirement for v-for is violated. By adding an index to the key, we ensure that every key is unique, but do not change the values displayed in the front-end.

This can only happen if the database incorrectly includes the same value in an array, such as the same tag applied to the same book multiple times. Instead of filtering out the duplicate tags, these should be displayed to ensure consistent behavior when comparing against the API or another client and allow the user to fix the duplicate tag.

This does not fix the root of the problem where the same tag can be added to the same book, but fixes the symptom.

How have you tested this?

Used database with the same tag on a book multiple times and ensured:

  • Correctly removes selected tag when no duplicates exists (unchanged)

  • Correctly adds new tags (unchanged)

  • Correctly removes selected tag when duplicate tags exist
    Screenshot from 2025-08-30 10-07-57
    Screenshot from 2025-08-30 10-08-01

  • Correctly removes all duplicate tags when unselected using the dropdown

Screenshot from 2025-08-30 10-07-27 Screenshot from 2025-08-30 10-07-33

Screenshots

See above to match with test case.


🔄 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/4636 **Author:** [@nichwall](https://github.com/nichwall) **Created:** 8/30/2025 **Status:** ✅ Merged **Merged:** 9/3/2025 **Merged by:** [@advplyr](https://github.com/advplyr) **Base:** `master` ← **Head:** `multiselect_duplicate_entries` --- ### 📝 Commits (2) - [`afab429`](https://github.com/advplyr/audiobookshelf/commit/afab429c753f30c1fad394eb5e1c250cfb100372) Fix: ensure all keys are unique in MultiSelect - [`ba7160c`](https://github.com/advplyr/audiobookshelf/commit/ba7160c30587cfd7da82a8dfdb9e026a0a785a2c) Add index to removeItem on multiselect keydown ### 📊 Changes **1 file changed** (+6 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `client/components/ui/MultiSelect.vue` (+6 -4) </details> ### 📄 Description <!-- For Work In Progress Pull Requests, please use the Draft PR feature, see https://github.blog/2019-02-14-introducing-draft-pull-requests/ for further details. If you do not follow this template, the PR may be closed without review. Please ensure all checks pass. If you are a new contributor, the workflows will need to be manually approved before they run. --> ## Brief summary This PR adds a unique identifier to the Vue for loop to ensure all keys have a unique identifier. ## Which issue is fixed? Related to https://github.com/advplyr/audiobookshelf/issues/4634 ## In-depth Description If the same key exists multiple times in a MultiSelect component, the unique key requirement for `v-for` is violated. By adding an index to the key, we ensure that every key is unique, but do not change the values displayed in the front-end. This can only happen if the database incorrectly includes the same value in an array, such as the same tag applied to the same book multiple times. Instead of filtering out the duplicate tags, these should be displayed to ensure consistent behavior when comparing against the API or another client and allow the user to fix the duplicate tag. This does not fix the root of the problem where the same tag can be added to the same book, but fixes the symptom. ## How have you tested this? Used database with the same tag on a book multiple times and ensured: - Correctly removes selected tag when no duplicates exists (unchanged) - Correctly adds new tags (unchanged) - Correctly removes selected tag when duplicate tags exist <img width="775" height="83" alt="Screenshot from 2025-08-30 10-07-57" src="https://github.com/user-attachments/assets/1467a9ec-f9cd-465a-b3f4-a8b696642819" /> <img width="775" height="83" alt="Screenshot from 2025-08-30 10-08-01" src="https://github.com/user-attachments/assets/3f040d39-85b0-46b4-8a82-6ca01a9b766b" /> - Correctly removes all duplicate tags when unselected using the dropdown <img width="775" height="150" alt="Screenshot from 2025-08-30 10-07-27" src="https://github.com/user-attachments/assets/cecf11ea-7eea-432e-acd4-3cd504ad13ac" /> <img width="775" height="150" alt="Screenshot from 2025-08-30 10-07-33" src="https://github.com/user-attachments/assets/ac093321-6e08-481d-8ef8-1f9e5d6337ad" /> ## Screenshots See above to match with test case. --- <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:13 +02:00
adam closed this issue 2026-04-25 00:19:13 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#4308