@@ -123,11 +123,9 @@ function BaseText(
123123 useEffect ( ( ) => {
124124 return dialog . events . depends ( [
125125 dialog . events . on ( DialogState . Events . requestComplete , ( ) => {
126- gameState . logger . debug ( "Sentence.tsx" , "requestComplete" ) ;
127126 taskRef . current ?. interact ( ) ;
128127 } ) ,
129128 dialog . events . on ( DialogState . Events . forceSkip , ( ) => {
130- gameState . logger . debug ( "Sentence.tsx" , "forceSkip" ) ;
131129 if ( ! dialog . isEnded ( ) ) {
132130 taskRef . current ?. forceSkip ( ) ;
133131 }
@@ -140,12 +138,14 @@ function BaseText(
140138 * - autoForward, gameSpeed changes
141139 */
142140 useEffect ( ( ) => {
143- game . preference . onPreferenceChange ( Game . Preferences . gameSpeed , ( ) => {
144- taskRef . current ?. update ( ) ;
145- } ) ;
146- game . preference . onPreferenceChange ( Game . Preferences . autoForward , ( ) => {
147- taskRef . current ?. update ( ) ;
148- } ) ;
141+ return game . preference . events . depends ( [
142+ game . preference . onPreferenceChange ( Game . Preferences . gameSpeed , ( ) => {
143+ taskRef . current ?. update ( ) ;
144+ } ) ,
145+ game . preference . onPreferenceChange ( Game . Preferences . autoForward , ( ) => {
146+ taskRef . current ?. update ( ) ;
147+ } )
148+ ] ) . cancel ;
149149 } , [ ] ) ;
150150
151151 function roll ( ) : RollingTask {
@@ -202,8 +202,6 @@ function BaseText(
202202 } ;
203203
204204 const trySkip = ( untilEnd : boolean = false ) => {
205- gameState . logger . debug ( "Sentence.tsx" , "skipToEnd" ) ;
206-
207205 // Skip to next pause or end
208206 let exited = false ;
209207 while ( ! exited ) {
0 commit comments