import { commentHrefToIds } from '../../commentHrefToIds' ; /**
 * Remove the TRs at the bottom of the comment table which will be visible if user navigates to the next page
 * so as to leave visible only the TRs for deleted comments which would have fallen through the cracks due to pagination
 */ export const removeRedundantTrs = ( apiCommentIds ) => { const trailingRows = document . querySelectorAll ( '[data-cpuserscript-unverified-trailing-row]' ) ; let haveFoundExistingPost = false ; trailingRows . forEach ( ( tr ) => { const { commentId } = commentHrefToIds ( tr . querySelector ( 'a' ) ! . href ) ; if ( apiCommentIds . has ( commentId ) ) { haveFoundExistingPost = true ; } if ( haveFoundExistingPost ) { tr . remove ( ) ; } else { tr . removeAttribute ( 'data-cpuserscript-unverified-trailing-row' ) ; } } ) ; } ;