ReadingLists currently queries the database to get info about default Reading List, including the list id and the reading list size.
data-mw-list-page-count is set as a data attribute on the button and is used client-side in the readingLists.bookmark.edit hook. We listen to the hook in WikimediaEvents where we have our experiment code.
- Check with @jwang and @HFan-WMF if we still need to include article_count in future metrics?
- If we need it, then initialize the count as null and then update it as part of the API response on the first page save / unsave action.
We also use it check listPageCount === 1 when determining whether or not to show the "Saved pages" onboarding dialog, pointing users to the "Saved pages" item in the user menu. For this, we already check the readinglists-saved-pages-dialog-seen local storage key and checking page count might be redundant and this check can be removed.
We need to avoid database queries such as this when a user with ReadingLists views an article.