import { showToastError } from '../../../common/showToast' ; import { getPostInfo } from './getPostInfo' ; import { postLinkToIds } from './postLinkToIds' ; const dedupe = ( arr ) => [ ... new Set ( arr ) ] ; export const addRowstats = ( ) => { const tableExists = document . querySelector ( '.history-table' ) ; if ( ! tableExists ) { return ; } const anchors = [ ... document . querySelectorAll < HTMLAnchorElement > ( '.history-table a[href]' ) ] ; const questionIds = dedupe ( anchors . map ( a => postLinkToIds ( a . href ) . questionId ) ) ; getPostInfo ( questionIds ) . catch ( ( error ) => { console . error ( error ) ; showToastError ( 'Stack Voted Posts Stats: An error occurred, see console for details' ) ; } ) ; } ;