File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
projects/packages/forms/src/dashboard/inbox Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 1+ import { formatNumber } from '@automattic/number-formatters' ;
2+
13// Function to get the URL of the page or post where the form was submitted.
24export const getPath = item => {
35 try {
@@ -18,7 +20,7 @@ function updateBadge( element, count ) {
1820 const oldClass = [ ...element . classList ] . find ( c => c . startsWith ( 'count-' ) ) ;
1921 element . classList . replace ( oldClass , `count-${ count } ` ) ;
2022 element . ariaHidden = count > 0 ? 'false' : 'true' ;
21- element . textContent = count ;
23+ element . textContent = formatNumber ( count ) ;
2224}
2325
2426/**
@@ -49,7 +51,8 @@ export const updateMenuCounterOptimistically = count => {
4951 document . querySelectorAll ( '.jp-feedback-unread-counter' ) . forEach ( item => {
5052 let optimisticCount = 0 ;
5153 if ( item . textContent !== '' ) {
52- optimisticCount = parseInt ( item . textContent , 10 ) + count ;
54+ // Ensure large formatted numbers like "1,000" are converted to integers properly
55+ optimisticCount = parseInt ( item . textContent . replace ( / \D / g, '' ) , 10 ) + count ;
5356 }
5457
5558 updateBadge ( item , optimisticCount ) ;
You can’t perform that action at this time.
0 commit comments