@@ -704,6 +704,8 @@ impl DocumentInfo {
704704 let count = {
705705 let doc = self . document . read ( ) ;
706706 let changes = doc. automerge . get_changes ( & self . last_heads ) ;
707+ println ! ( "last: {:?}, current: {:?}" , self . last_heads, doc. automerge. get_heads( ) ) ;
708+ //self.last_heads = doc.automerge.get_heads();
707709 changes. len ( )
708710 } ;
709711 let has_patches = count > 0 ;
@@ -1231,16 +1233,13 @@ impl Repo {
12311233 // Handle doc changes: sync the document.
12321234 let local_repo_id = self . get_repo_id ( ) . clone ( ) ;
12331235 if let Some ( info) = self . documents . get_mut ( & doc_id) {
1234- if !info. note_changes ( ) {
1235- println ! ( "Doc didn't change" ) ;
1236- // Stop here if the document wasn't actually changed.
1237- return ;
1236+ if info. note_changes ( ) {
1237+ self . documents_with_changes . push ( doc_id. clone ( ) ) ;
12381238 }
12391239 let is_first_edit = matches ! ( info. state, DocState :: LocallyCreatedNotEdited ) ;
12401240 if is_first_edit {
12411241 info. state = DocState :: Sync ( vec ! [ ] ) ;
12421242 }
1243- self . documents_with_changes . push ( doc_id. clone ( ) ) ;
12441243 for ( to_repo_id, message) in info. generate_sync_messages ( ) . into_iter ( ) {
12451244 let outgoing = NetworkMessage :: Sync {
12461245 from_repo_id : local_repo_id. clone ( ) ,
@@ -1255,6 +1254,7 @@ impl Repo {
12551254 self . sinks_to_poll . insert ( to_repo_id) ;
12561255 }
12571256 if is_first_edit {
1257+ println ! ( "First edit" ) ;
12581258 // Send a sync message to all other repos we are connected with.
12591259 for repo_id in self . remote_repos . keys ( ) {
12601260 if let Some ( message) = info. generate_first_sync_message ( repo_id. clone ( ) )
@@ -1348,6 +1348,7 @@ impl Repo {
13481348 let state = info. document . read ( ) ;
13491349 state. automerge . get_heads ( )
13501350 } ;
1351+ println ! ( "Change observer: {:?} {:?}" , current_heads, change_hash) ;
13511352 if current_heads == change_hash {
13521353 info. change_observers . push ( observer) ;
13531354 } else {
@@ -1473,8 +1474,9 @@ impl Repo {
14731474 . expect ( "Doc should have an info by now." ) ;
14741475
14751476 if info. receive_sync_message ( per_remote) {
1476- info. note_changes ( ) ;
1477- self . documents_with_changes . push ( document_id. clone ( ) ) ;
1477+ if info. note_changes ( ) {
1478+ self . documents_with_changes . push ( document_id. clone ( ) ) ;
1479+ }
14781480 }
14791481
14801482 // Note: since receiving and generating sync messages is done
0 commit comments