[Bug]: Caching issues when changing filters and sorting order #2572

Closed
opened 2026-04-25 00:08:30 +02:00 by adam · 2 comments
Owner

Originally created by @Klaesy on GitHub (Feb 13, 2025).

What happened?

Looking at the rest call responses the issue occurs, because the response contains total: 0 while also containing results. (See the second to last log line)

I'm unable to create a very solid reproduction path, due to me attempting to reproduce it for a bit. Since I expect the issue is somehow caused by caching, my results my thus be different from others.

However when I keep turning on and off the Issues filter, while changing the sorting order in between, the results shown are often incorrect (either a lot of empty cards are being shown or it says my library is empty when it shouldn't be).

What did you expect to happen?

All my audiobooks instead of AudioBooks Library is empty!.

Steps to reproduce the issue

  1. Go to the library tab
  2. Change the filter to issues (so hopefully no results are returned)
  3. Change the sorting to something else (or change the order)
  4. Remove the filter
  5. Change the sorting back to the previous option
  6. No results should be shown

Audiobookshelf version

v2.19.2

How are you running audiobookshelf?

Docker

What OS is your Audiobookshelf server hosted from?

Linux

If the issue is being seen in the UI, what browsers are you seeing the problem on?

Firefox

Logs

[2025-02-13 22:14:46.545] DEBUG: [ApiCacheManager] count: 5 size: 188866

[2025-02-13 22:14:46.545] DEBUG: [ApiCacheManager] Cache hit: {"user":"Skippy","url":"/libraries/c533b967-4bce-42bc-bf1f-b58b64b34583?include=filterdata"}

[2025-02-13 22:14:46.707] DEBUG: [ApiCacheManager] count: 5 size: 188866

[2025-02-13 22:14:46.710] DEBUG: [LibraryItemsBookFilters] findOptionsKey: {"where":[{}],"distinct":true,"attributes":null,"replacements":{},"include":[{"required":true,"where":{"libraryId":"c533b967-4bce-42bc-bf1f-b58b64b34583"},"include":[{"required":false,"separate":true}]},{"attributes":["id","seriesId","sequence","createdAt"],"include":{"attributes":["id","name","nameIgnorePrefix"]},"order":[["createdAt","ASC"]],"separate":true},{"attributes":["authorId","createdAt"],"include":{"attributes":["id","name"]},"order":[["createdAt","ASC"]],"separate":true}],"order":[[{"val":"libraryItem.createdAt"},"DESC"]],"subQuery":false}

[2025-02-13 22:14:46.719] DEBUG: Loaded 0 of 0 items for libary page in 0.01s

[2025-02-13 22:14:46.720] DEBUG: [ApiCacheManager] Cache miss: {"user":"Skippy","url":"/libraries/c533b967-4bce-42bc-bf1f-b58b64b34583/items?filter=issues&sort=addedAt&desc=1&limit=40&page=0&minified=1&include=rssfeed,numEpisodesIncomplete,share"}

[2025-02-13 22:14:47.910] DEBUG: [ApiCacheManager] count: 6 size: 189183

[2025-02-13 22:14:47.910] DEBUG: [ApiCacheManager] Cache hit: {"user":"Skippy","url":"/libraries/c533b967-4bce-42bc-bf1f-b58b64b34583?include=filterdata"}

[2025-02-13 22:14:48.007] DEBUG: [ApiCacheManager] count: 6 size: 189183

[2025-02-13 22:14:48.120] DEBUG: [ApiCacheManager] Cache miss: {"user":"Skippy","url":"/libraries/c533b967-4bce-42bc-bf1f-b58b64b34583/series?sort=name&desc=0&filter=all&limit=24&page=0&minified=1&include=rssfeed,numEpisodesIncomplete,share"}

[2025-02-13 22:14:48.555] DEBUG: [ApiCacheManager] count: 7 size: 372627

[2025-02-13 22:14:48.555] DEBUG: [ApiCacheManager] Cache hit: {"user":"Skippy","url":"/libraries/c533b967-4bce-42bc-bf1f-b58b64b34583?include=filterdata"}

[2025-02-13 22:14:48.697] DEBUG: [ApiCacheManager] count: 7 size: 372627

[2025-02-13 22:14:48.698] DEBUG: [ApiCacheManager] Cache hit: {"user":"Skippy","url":"/libraries/c533b967-4bce-42bc-bf1f-b58b64b34583/items?filter=issues&sort=addedAt&desc=1&limit=40&page=0&minified=1&include=rssfeed,numEpisodesIncomplete,share"}

[2025-02-13 22:14:49.964] DEBUG: [ApiCacheManager] count: 7 size: 372627

[2025-02-13 22:14:49.967] DEBUG: [LibraryItemsBookFilters] findOptionsKey: {"where":[{}],"distinct":true,"attributes":null,"replacements":{},"include":[{"required":true,"where":{"libraryId":"c533b967-4bce-42bc-bf1f-b58b64b34583"},"include":[{"required":false,"separate":true}]},{"attributes":["id","seriesId","sequence","createdAt"],"include":{"attributes":["id","name","nameIgnorePrefix"]},"order":[["createdAt","ASC"]],"separate":true},{"attributes":["authorId","createdAt"],"include":{"attributes":["id","name"]},"order":[["createdAt","ASC"]],"separate":true}],"order":[[{"val":"libraryItem.createdAt"},"DESC"]],"subQuery":false}

[2025-02-13 22:14:49.989] DEBUG: Loaded 40 of 0 items for libary page in 0.02s

[2025-02-13 22:14:49.990] DEBUG: [ApiCacheManager] Cache miss: {"user":"Skippy","url":"/libraries/c533b967-4bce-42bc-bf1f-b58b64b34583/items?sort=addedAt&desc=1&limit=40&page=0&minified=1&include=rssfeed,numEpisodesIncomplete,share"}

Additional Notes

Originally created by @Klaesy on GitHub (Feb 13, 2025). ### What happened? Looking at the rest call responses the issue occurs, because the response contains `total: 0` while also containing `results`. (See the second to last log line) I'm unable to create a very solid reproduction path, due to me attempting to reproduce it for a bit. Since I expect the issue is somehow caused by caching, my results my thus be different from others. However when I keep turning on and off the `Issues` filter, while changing the sorting order in between, the results shown are often incorrect (either a lot of empty cards are being shown or it says my library is empty when it shouldn't be). ### What did you expect to happen? All my audiobooks instead of `AudioBooks Library is empty!`. ### Steps to reproduce the issue 1. Go to the library tab 2. Change the filter to issues (so hopefully no results are returned) 3. Change the sorting to something else (or change the order) 4. Remove the filter 5. Change the sorting back to the previous option 6. No results should be shown ### Audiobookshelf version v2.19.2 ### How are you running audiobookshelf? Docker ### What OS is your Audiobookshelf server hosted from? Linux ### If the issue is being seen in the UI, what browsers are you seeing the problem on? Firefox ### Logs ```shell [2025-02-13 22:14:46.545] DEBUG: [ApiCacheManager] count: 5 size: 188866 [2025-02-13 22:14:46.545] DEBUG: [ApiCacheManager] Cache hit: {"user":"Skippy","url":"/libraries/c533b967-4bce-42bc-bf1f-b58b64b34583?include=filterdata"} [2025-02-13 22:14:46.707] DEBUG: [ApiCacheManager] count: 5 size: 188866 [2025-02-13 22:14:46.710] DEBUG: [LibraryItemsBookFilters] findOptionsKey: {"where":[{}],"distinct":true,"attributes":null,"replacements":{},"include":[{"required":true,"where":{"libraryId":"c533b967-4bce-42bc-bf1f-b58b64b34583"},"include":[{"required":false,"separate":true}]},{"attributes":["id","seriesId","sequence","createdAt"],"include":{"attributes":["id","name","nameIgnorePrefix"]},"order":[["createdAt","ASC"]],"separate":true},{"attributes":["authorId","createdAt"],"include":{"attributes":["id","name"]},"order":[["createdAt","ASC"]],"separate":true}],"order":[[{"val":"libraryItem.createdAt"},"DESC"]],"subQuery":false} [2025-02-13 22:14:46.719] DEBUG: Loaded 0 of 0 items for libary page in 0.01s [2025-02-13 22:14:46.720] DEBUG: [ApiCacheManager] Cache miss: {"user":"Skippy","url":"/libraries/c533b967-4bce-42bc-bf1f-b58b64b34583/items?filter=issues&sort=addedAt&desc=1&limit=40&page=0&minified=1&include=rssfeed,numEpisodesIncomplete,share"} [2025-02-13 22:14:47.910] DEBUG: [ApiCacheManager] count: 6 size: 189183 [2025-02-13 22:14:47.910] DEBUG: [ApiCacheManager] Cache hit: {"user":"Skippy","url":"/libraries/c533b967-4bce-42bc-bf1f-b58b64b34583?include=filterdata"} [2025-02-13 22:14:48.007] DEBUG: [ApiCacheManager] count: 6 size: 189183 [2025-02-13 22:14:48.120] DEBUG: [ApiCacheManager] Cache miss: {"user":"Skippy","url":"/libraries/c533b967-4bce-42bc-bf1f-b58b64b34583/series?sort=name&desc=0&filter=all&limit=24&page=0&minified=1&include=rssfeed,numEpisodesIncomplete,share"} [2025-02-13 22:14:48.555] DEBUG: [ApiCacheManager] count: 7 size: 372627 [2025-02-13 22:14:48.555] DEBUG: [ApiCacheManager] Cache hit: {"user":"Skippy","url":"/libraries/c533b967-4bce-42bc-bf1f-b58b64b34583?include=filterdata"} [2025-02-13 22:14:48.697] DEBUG: [ApiCacheManager] count: 7 size: 372627 [2025-02-13 22:14:48.698] DEBUG: [ApiCacheManager] Cache hit: {"user":"Skippy","url":"/libraries/c533b967-4bce-42bc-bf1f-b58b64b34583/items?filter=issues&sort=addedAt&desc=1&limit=40&page=0&minified=1&include=rssfeed,numEpisodesIncomplete,share"} [2025-02-13 22:14:49.964] DEBUG: [ApiCacheManager] count: 7 size: 372627 [2025-02-13 22:14:49.967] DEBUG: [LibraryItemsBookFilters] findOptionsKey: {"where":[{}],"distinct":true,"attributes":null,"replacements":{},"include":[{"required":true,"where":{"libraryId":"c533b967-4bce-42bc-bf1f-b58b64b34583"},"include":[{"required":false,"separate":true}]},{"attributes":["id","seriesId","sequence","createdAt"],"include":{"attributes":["id","name","nameIgnorePrefix"]},"order":[["createdAt","ASC"]],"separate":true},{"attributes":["authorId","createdAt"],"include":{"attributes":["id","name"]},"order":[["createdAt","ASC"]],"separate":true}],"order":[[{"val":"libraryItem.createdAt"},"DESC"]],"subQuery":false} [2025-02-13 22:14:49.989] DEBUG: Loaded 40 of 0 items for libary page in 0.02s [2025-02-13 22:14:49.990] DEBUG: [ApiCacheManager] Cache miss: {"user":"Skippy","url":"/libraries/c533b967-4bce-42bc-bf1f-b58b64b34583/items?sort=addedAt&desc=1&limit=40&page=0&minified=1&include=rssfeed,numEpisodesIncomplete,share"} ``` ### Additional Notes -
adam added the bug label 2026-04-25 00:08:30 +02:00
adam closed this issue 2026-04-25 00:08:30 +02:00
Author
Owner

@advplyr commented on GitHub (Feb 14, 2025):

I see the issue. It has to do with JSON.stringify with Symbols. I'm looking into a fix

@advplyr commented on GitHub (Feb 14, 2025): I see the issue. It has to do with JSON.stringify with Symbols. I'm looking into a fix
Author
Owner

@github-actions[bot] commented on GitHub (Feb 17, 2025):

Fixed in v2.19.3.

@github-actions[bot] commented on GitHub (Feb 17, 2025): Fixed in [v2.19.3](https://github.com/advplyr/audiobookshelf/releases/tag/v2.19.3).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#2572