@@ -307,42 +307,45 @@ const ResponsiveDataTable = ({
307307 year : 'numeric'
308308 } ;
309309
310- return new Intl . DateTimeFormat ( 'un -US' , dateOptions ) . format ( date ) ;
310+ return new Intl . DateTimeFormat ( 'en -US' , dateOptions ) . format ( date ) ;
311311 } ;
312312
313- const updatedOptions = {
314- ...options ,
315- print : false ,
316- download : false ,
317- search : false ,
318- filter : false ,
319- viewColumns : false ,
320- rowsPerPageOptions : rowsPerPageOptions ,
321- onViewColumnsChange : ( column : string , action : string ) => {
322- switch ( action ) {
323- case 'add' : {
324- const colToAdd = columns . find ( ( obj ) => obj . name === column ) ;
325- if ( colToAdd ) {
326- if ( colToAdd . options ) {
327- colToAdd . options . display = true ;
328- updateCols && updateCols ( [ ...columns ] ) ;
313+ const updatedOptions = React . useMemo (
314+ ( ) => ( {
315+ ...options ,
316+ print : false ,
317+ download : false ,
318+ search : false ,
319+ filter : false ,
320+ viewColumns : false ,
321+ rowsPerPageOptions : rowsPerPageOptions ,
322+ onViewColumnsChange : ( column : string , action : string ) => {
323+ switch ( action ) {
324+ case 'add' : {
325+ const colToAdd = columns . find ( ( obj ) => obj . name === column ) ;
326+ if ( colToAdd ) {
327+ if ( colToAdd . options ) {
328+ colToAdd . options . display = true ;
329+ updateCols && updateCols ( [ ...columns ] ) ;
330+ }
329331 }
332+ break ;
330333 }
331- break ;
332- }
333- case 'remove' : {
334- const colToRemove = columns . find ( ( obj ) => obj . name === column ) ;
335- if ( colToRemove ) {
336- if ( colToRemove . options ) {
337- colToRemove . options . display = false ;
338- updateCols && updateCols ( [ ...columns ] ) ;
334+ case 'remove' : {
335+ const colToRemove = columns . find ( ( obj ) => obj . name === column ) ;
336+ if ( colToRemove ) {
337+ if ( colToRemove . options ) {
338+ colToRemove . options . display = false ;
339+ updateCols && updateCols ( [ ...columns ] ) ;
340+ }
339341 }
342+ break ;
340343 }
341- break ;
342344 }
343345 }
344- }
345- } ;
346+ } ) ,
347+ [ options , rowsPerPageOptions , columns , updateCols ]
348+ ) ;
346349
347350 const updateColumnsEffect = useCallback ( ( ) => {
348351 columns ?. forEach ( ( col ) => {
@@ -385,8 +388,7 @@ const ResponsiveDataTable = ({
385388 }
386389 } ) ;
387390 updateCols && updateCols ( [ ...columns ] ) ;
388- // eslint-disable-next-line react-hooks/exhaustive-deps
389- } , [ columnVisibility , updateCols , data ] ) ;
391+ } , [ columnVisibility , updateCols , columns ] ) ;
390392
391393 React . useEffect ( ( ) => {
392394 updateColumnsEffect ( ) ;
0 commit comments