@@ -138,9 +138,8 @@ function initTogetherJS() {
138138 // Remember, they were here first (that's why they're saying 'hello-back'),
139139 // so they keep their own name, but you need to change yours :)
140140 TogetherJS . hub . on ( "togetherjs.hello-back" , function ( msg ) {
141- // guard against weird cases where someone is in your same session
142- // but accidentally meandered to another page
143- if ( ! msg . sameUrl ) return ;
141+ // do NOT use a msg.sameUrl guard since that will miss some signals
142+ // due to our funky URLs
144143
145144 var p = TogetherJS . require ( "peers" ) ;
146145
@@ -201,9 +200,8 @@ function initTogetherJS() {
201200 }
202201
203202 TogetherJS . hub . on ( "updateOutput" , function ( msg ) {
204- // guard against weird cases where someone is in your same session
205- // but accidentally meandered to another page
206- if ( ! msg . sameUrl ) return ;
203+ // do NOT use a msg.sameUrl guard since that will miss some signals
204+ // due to our funky URLs
207205
208206 if ( isExecutingCode ) {
209207 return ;
@@ -222,9 +220,8 @@ function initTogetherJS() {
222220 } ) ;
223221
224222 TogetherJS . hub . on ( "executeCode" , function ( msg ) {
225- // guard against weird cases where someone is in your same session
226- // but accidentally meandered to another page
227- if ( ! msg . sameUrl ) return ;
223+ // do NOT use a msg.sameUrl guard since that will miss some signals
224+ // due to our funky URLs
228225
229226 if ( isExecutingCode ) {
230227 return ;
@@ -241,9 +238,8 @@ function initTogetherJS() {
241238 } ) ;
242239
243240 TogetherJS . hub . on ( "hashchange" , function ( msg ) {
244- // guard against weird cases where someone is in your same session
245- // but accidentally meandered to another page
246- if ( ! msg . sameUrl ) return ;
241+ // do NOT use a msg.sameUrl guard since that will miss some signals
242+ // due to our funky URLs
247243
248244 if ( isExecutingCode ) {
249245 return ;
@@ -264,9 +260,8 @@ function initTogetherJS() {
264260 } ) ;
265261
266262 TogetherJS . hub . on ( "codemirror-edit" , function ( msg ) {
267- // guard against weird cases where someone is in your same session
268- // but accidentally meandered to another page
269- if ( ! msg . sameUrl ) return ;
263+ // do NOT use a msg.sameUrl guard since that will miss some signals
264+ // due to our funky URLs
270265
271266 if ( ! $ ( "#codeInputWarnings" ) . data ( 'orig-html' ) ) { // set only once
272267 $ ( "#codeInputWarnings" ) . data ( 'orig-html' , $ ( "#codeInputWarnings" ) . html ( ) ) ;
@@ -281,9 +276,8 @@ function initTogetherJS() {
281276 } ) ;
282277
283278 TogetherJS . hub . on ( "requestSync" , function ( msg ) {
284- // guard against weird cases where someone is in your same session
285- // but accidentally meandered to another page
286- if ( ! msg . sameUrl ) return ;
279+ // do NOT use a msg.sameUrl guard since that will miss some signals
280+ // due to our funky URLs
287281
288282 if ( TogetherJS . running ) {
289283 TogetherJS . send ( { type : "myAppState" ,
@@ -296,9 +290,8 @@ function initTogetherJS() {
296290 } ) ;
297291
298292 TogetherJS . hub . on ( "myAppState" , function ( msg ) {
299- // guard against weird cases where someone is in your same session
300- // but accidentally meandered to another page
301- if ( ! msg . sameUrl ) return ;
293+ // do NOT use a msg.sameUrl guard since that will miss some signals
294+ // due to our funky URLs
302295
303296 // if we didn't explicitly request a sync, then don't do anything
304297 if ( ! togetherjsSyncRequested ) {
@@ -355,17 +348,15 @@ function initTogetherJS() {
355348 } ) ;
356349
357350 TogetherJS . hub . on ( "codeInputScroll" , function ( msg ) {
358- // guard against weird cases where someone is in your same session
359- // but accidentally meandered to another page
360- if ( ! msg . sameUrl ) return ;
351+ // do NOT use a msg.sameUrl guard since that will miss some signals
352+ // due to our funky URLs
361353
362354 $ ( codeMirrorScroller ) . scrollTop ( msg . scrollTop ) ;
363355 } ) ;
364356
365357 TogetherJS . hub . on ( "pyCodeOutputDivScroll" , function ( msg ) {
366- // guard against weird cases where someone is in your same session
367- // but accidentally meandered to another page
368- if ( ! msg . sameUrl ) return ;
358+ // do NOT use a msg.sameUrl guard since that will miss some signals
359+ // due to our funky URLs
369360
370361 if ( myVisualizer ) {
371362 myVisualizer . domRoot . find ( '#pyCodeOutputDiv' ) . scrollTop ( msg . scrollTop ) ;
0 commit comments