@@ -512,6 +512,12 @@ chrome.runtime.onConnect.addListener(async (port) => {
512512 tabsObj [ tabId ] . currBranch = 1 ; // reset currBranch
513513 tabsObj [ tabId ] . currLocation = tabsObj [ tabId ] . hierarchy ; // reset currLocation
514514
515+ // Hide click-replay visualization since snapshots were cleared
516+ try {
517+ chrome . tabs . sendMessage ( tabId , { action : 'hideClickReplay' } ) ;
518+ } catch ( err ) {
519+ // Tab may be closed or content script not loaded
520+ }
515521 return true ; // return true so that port remains open
516522
517523 case 'setPause' : // Pause = lock on tab
@@ -733,6 +739,12 @@ chrome.runtime.onMessage.addListener(async (request, sender, sendResponse) => {
733739 ) ;
734740 }
735741
742+ // User action created new snapshot; hide click-replay visualization
743+ try {
744+ chrome . tabs . sendMessage ( sourceTab , { action : 'hideClickReplay' } ) ;
745+ } catch ( err ) {
746+ /* tab may be closed */
747+ }
736748 break ;
737749 }
738750
@@ -756,15 +768,29 @@ chrome.runtime.onMessage.addListener(async (request, sender, sendResponse) => {
756768
757769 if ( isDuplicateSnapshot ( previousSnap , incomingSnap ) ) {
758770 console . warn ( 'Duplicate snapshot detected, skipping' ) ;
771+ // Still hide pointer - user interaction triggered a snapshot even if we skipped it
772+ try {
773+ chrome . tabs . sendMessage ( sourceTab , { action : 'hideClickReplay' } ) ;
774+ } catch ( err ) {
775+ /* tab may be closed */
776+ }
759777 break ;
760778 }
761779
762780 // Or if it is a snapShot after a jump, we don't record it.
781+ let didAddSnapshot = false ;
763782 if ( reloaded [ tabId ] ) {
764783 // don't add anything to snapshot storage if tab is reloaded for the initial snapshot
765784 reloaded [ tabId ] = false ;
785+ // Still hide pointer - snapshot after jump, user has moved on
786+ try {
787+ chrome . tabs . sendMessage ( sourceTab , { action : 'hideClickReplay' } ) ;
788+ } catch ( err ) {
789+ /* tab may be closed */
790+ }
766791 } else {
767792 tabsObj [ tabId ] . snapshots . push ( request . payload ) ;
793+ didAddSnapshot = true ;
768794 // INVOKING buildHierarchy FIGURE OUT WHAT TO PASS IN
769795 if ( ! tabsObj [ tabId ] [ index ] ) {
770796 // check if accessibility recording has been toggled on
@@ -799,6 +825,15 @@ chrome.runtime.onMessage.addListener(async (request, sender, sendResponse) => {
799825 } else {
800826 console . warn ( 'No active ports to send snapshots to.' ) ;
801827 }
828+
829+ // User action created new snapshot; hide click-replay visualization
830+ if ( didAddSnapshot ) {
831+ try {
832+ chrome . tabs . sendMessage ( sourceTab , { action : 'hideClickReplay' } ) ;
833+ } catch ( err ) {
834+ /* tab may be closed */
835+ }
836+ }
802837 }
803838 default :
804839 break ;
0 commit comments