Commit e107be5 1 parent b1e98ca commit e107be5 Copy full SHA for e107be5
File tree 1 file changed +13
-5
lines changed
1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -66,11 +66,19 @@ export default function PopupMain(): JSX.Element {
66
66
} ;
67
67
68
68
useEffect ( ( ) => {
69
- const randomIndex = Math . floor ( Math . random ( ) * splashText . length ) ;
70
- setFunny (
71
- splashText [ randomIndex ] ?? 'If you are seeing this, something has gone horribly wrong behind the scenes.'
72
- ) ;
73
- } , [ ] ) ;
69
+ setFunny ( prevFunny => {
70
+ // Ensure that the next splash text is not the same as the previous one
71
+ const splashTextWithoutCurrent = splashText . filter ( text => text !== prevFunny ) ;
72
+ const randomIndex = Math . floor ( Math . random ( ) * splashTextWithoutCurrent . length ) ;
73
+
74
+ return (
75
+ splashTextWithoutCurrent [ randomIndex ] ??
76
+ 'If you are seeing this, something has gone horribly wrong behind the scenes.'
77
+ ) ;
78
+ } ) ;
79
+
80
+ // Generate a new splash text every time the active schedule changes
81
+ } , [ activeSchedule . id ] ) ;
74
82
75
83
const handleOpenOptions = async ( ) => {
76
84
const url = chrome . runtime . getURL ( '/options.html' ) ;
You can’t perform that action at this time.
0 commit comments