* Initialization preparations * 1. Check if there are any missing versions, and supplement if there are any. * 2. Check whether there are unsynchronized changesets locally, and if so, perform necessary transforms to keep revision and snapshot aligned * 3. Each engine will be prepared when i
(checkVersion?: number)
| 169 | * checkVersion does not exist when instantiated |
| 170 | */ |
| 171 | async prepare(checkVersion?: number) { |
| 172 | try { |
| 173 | await this.checkLocalDiffChanges(checkVersion); |
| 174 | this.prepared = true; |
| 175 | } catch (error) { |
| 176 | Player.doTrigger(Events.app_error_logger, { |
| 177 | error, |
| 178 | metaData: { |
| 179 | localPendingChangeset: this.bufferStorage.localPendingChangeset, |
| 180 | opBuffer: this.bufferStorage.opBuffer, |
| 181 | }, |
| 182 | }); |
| 183 | |
| 184 | // clear the local cache to prevent the problem from happening again |
| 185 | this.bufferStorage.clearLocalPendingChangeset(); |
| 186 | this.bufferStorage.clearOpBuffer(); |
| 187 | |
| 188 | this.event.onError && this.event.onError({ |
| 189 | type: ErrorType.CollaError, |
| 190 | code: ErrorCode.EngineCreateFailed, |
| 191 | message: t(Strings.local_data_conflict), |
| 192 | modalType: ModalType.Info |
| 193 | }); |
| 194 | } |
| 195 | } |
| 196 | |
| 197 | /** |
| 198 | * Completed the version supplement of local resources, and can perform collaborative data synchronization operations |
no test coverage detected