openlibrary
openlibrary copied to clipboard
Add to list widget lists don't populate on orphaned edition pages
Starting today I noticed that the list widget doesn't render correctly on some edition pages. At first I thought it was just an isolated issue with a specific book edition and assumed there must be something wrong with that edition, now I've observed it on a few different pages.
Evidence / Screenshot (if possible)
Relevant url?
https://openlibrary.org/books/OL18347637M/
Also: https://openlibrary.org/books/OL16869993M/
Steps to Reproduce
- Go to the above linked relevant URL
- Observe that the widget doesn't load correctly
- Click on the widget and no lists are shown
- Actual: The widget doesn't show any of my lists
- Expected: The widget shows my lists
Details
- Logged in (Y/N)? Yes
- Browser type/version? Firefox 91.12.0esr
- Operating system? Debian 11
- Environment (prod/dev/local)? prod
Proposal & Constraints
Related files
Stakeholders
I found another example at https://openlibrary.org/books/OL16819242M and something it has in common with one of the other examples is that it was imported without an author being set. There are some other anomalies in that it says "View all 0 editions" and "View 0 editions" in the editions list links. Is it not correctly associated with a work?
As far as I know, it is because this is orphaned editions (without assigned work). It should be enough to edit them once, and work will be automatically created for them.
@bicolino34 Should it be fixed in the code? Like hiding the entire widget if this is the case? Because after editing them with work, the whole view changes, and Add to list button is visible under the drop-down.
@muditjuneja I don't know if this is a good decision. Better ask @cdrini or @mekarpeles
@jimchamp @mekarpeles let me know, I can give it a try if needed.
I am not able to reproduce this issue -- is it possible it has since been fixed by @jimchamp ?
@muditjuneja if you're able to reproduce this issue, please do give it a try and we're happy to answer questions!
@mekarpeles Visit this URL and click on "Add to list button": https://openlibrary.org/books/OL16819242M/Turncoat_a_parody_of_the_tragedy_of_Athelstan._In_one_act
You will see that the lists are not being loaded (bcoz this item doesn't have work)
Awesome, thanks for sharing this link! @jimchamp and I can confirm that these are happening specifically to orphaned editions. We can investigate from here.
The other ones likely have been edited which often results in works being created for them (fixing the problem)
The list widget is expected to look this way on orphaned edition pages. The issue is that none of a patron's lists are present in the dropper on orphaned editions pages. This may be related to a breaking change to list widgets that occurred some time ago (PR: #6159).
Before #6159 was merged, lists displayed in the drop-down would be updated when the "Use this Work" checkbox was toggled:
When clicked, only lists that didn't contain the book's work OLID would be present in the dropper, beneath "My Reading Lists" (more clearly, lists not containing the work were listed in the dropper). The lists would update to lists not containing the edition if the checkbox was unchecked.
Today, the view does not update when the checkbox is toggled. One can still choose to add a work or edition to a list by using the checkbox, though.
I noticed that a can add an orphaned edition to a new list (the current record is added to any newly created list). When added, I noticed that the new list didn't appear in the #already-lists
container (this is directly below the dropper, and provides a way for people to remove an item from a list).
All this is to say that the underlying list functionality is working properly, but the view is not initially being populated correctly nor updated properly on orphaned editions pages.
Updated the title to reflect what we've already learned through this discussion, and thank you to all who've participated so far :)
I think that, at its core, this issue is that one cannot add a work to a list via the UI, as the UI doesn't properly update when "Use this work" is selected.
@DebbieSan, not sure if you're aware of this. I'll fix this while we're improving on the lists dropper.
I noticed that the " use this work" box wasn't necessarily working at times. Is this what you are referring to?
Thank you for all of this, I really appreciate it as I was blocked for a bit.
@DebbieSan sorry for the delay! That's exactly what I mean. I'm pretty sure that I broke this when I worked on adding "Want to Read" buttons to search results.