@@ -131,6 +131,19 @@ async def initialize(self) -> None:
131
131
# YDoc not found in the YStore, create the document from the source file (no change history)
132
132
pass
133
133
134
+ if not read_from_source and self ._document .source != model ["content" ]:
135
+ # TODO: Delete document from the store.
136
+ self ._emit (
137
+ LogLevel .INFO , "initialize" , "The file is out-of-sync with the ystore."
138
+ )
139
+ self .log .info (
140
+ "Content in file %s is out-of-sync with the ystore %s" ,
141
+ self ._file .path ,
142
+ self .ystore .__class__ .__name__ ,
143
+ )
144
+ read_from_source = True
145
+
146
+ # if YStore updates and source file are out-of-sync, resync updates with source
134
147
if read_from_source :
135
148
self ._emit (LogLevel .INFO , "load" , "Content loaded from disk." )
136
149
self .log .info (
@@ -140,20 +153,6 @@ async def initialize(self) -> None:
140
153
141
154
if self .ystore :
142
155
await self .ystore .encode_state_as_update (self .ydoc )
143
- else :
144
- # if YStore updates and source file are out-of-sync, resync updates with source
145
- if self ._document .source != model ["content" ]:
146
- # TODO: Delete document from the store.
147
- self ._emit (
148
- LogLevel .INFO , "initialize" , "The file is out-of-sync with the ystore."
149
- )
150
- self .log .info (
151
- "Content in file %s is out-of-sync with the ystore %s" ,
152
- self ._file .path ,
153
- self .ystore .__class__ .__name__ ,
154
- )
155
- read_from_source = True
156
-
157
156
158
157
self .ready = True
159
158
self ._emit (LogLevel .INFO , "initialize" , "Room initialized" )
0 commit comments