Page MenuHomePhabricator

Reading List article count size 0 is returning -1
Closed, ResolvedPublic0 Estimated Story PointsBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

Screenshot 2025-10-24 at 1.17.05 PM.png (936×748 px, 202 KB)

What happens?:

If currentReadingListSize[ listId ] === 0 then in updateListCount it is incorrectly returning -1 (as if the list is undefined).

Then we never get an accurate count of the updated list size when a user saves their first page to the reading list,

	/**
	 * Updates the mw-list-page-count data attribute with the reading list page count
	 *
	 * @param {string} listId
	 * @param {boolean} isSaved
	 * @return {number} -1 if the reading list size is not known
	 */
	function updateListCount( listId, isSaved ) {
		if ( !currentReadingListSize[ listId ] ) {
			return -1;
		} else {
			currentReadingListSize[ listId ] += ( isSaved ? 1 : -1 );
			return currentReadingListSize[ listId ];
		}
	}

	function updateBookmarkStatus( isSaved, listId, entryId ) {
		const listPageCount = updateListCount( listId, isSaved );

What should have happened instead?:

The currentReadingListSize should be 0 and then incremented to 1 when a user saves their first page to their reading list.

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):

Other information (browser name/version, screenshots, etc.):

Event Timeline

Change #1198574 had a related patch set uploaded (by Aude; author: Aude):

[mediawiki/extensions/ReadingLists@master] Fix updating currentReadingListSize when count is 0

https://gerrit.wikimedia.org/r/1198574

aude triaged this task as High priority.Oct 27 2025, 6:49 PM
aude set the point value for this task to 0.
aude removed aude as the assignee of this task.Oct 27 2025, 6:52 PM
SToyofuku-WMF subscribed.

Volker to double check the review (thank you!)

Change #1198574 merged by jenkins-bot:

[mediawiki/extensions/ReadingLists@master] Fix updating currentReadingListSize when count is 0

https://gerrit.wikimedia.org/r/1198574