Dev team reuses existing cache to power plugin-update badge, avoiding duplicate state
A development team building a site management dashboard was asked to display pending plugin update counts as a badge on each site's plugins button in the site list. Rather than creating a new API endpoint and separate cache, the team reused an existing localStorage-backed state object called _updatesDashState, which already stored per-site plugin data from the cross-site updates dashboard. The badge logic simply looks up a site by its ID and reads the length of its plugins array, meaning no additional data synchronization is required. The team also chose to hide the badge entirely for sites with zero updates or unchecked status, reducing visual noise and preserving a meaningful distinction between 'no updates' and 'not yet checked'. Counts above 99 are displayed as '99+' to maintain consistent badge width, following a convention familiar from platforms like GitHub.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in