()
| 279 | } |
| 280 | |
| 281 | async finishSetup() { |
| 282 | try { |
| 283 | this.react.loading = true; |
| 284 | |
| 285 | // Setup collaboration |
| 286 | |
| 287 | await this.collab.setup(); |
| 288 | |
| 289 | // Post-sync setup |
| 290 | |
| 291 | this.elems.setup(); |
| 292 | |
| 293 | this.undoRedo.setup(); |
| 294 | |
| 295 | this.react.status = 'success'; |
| 296 | |
| 297 | await sleep(); |
| 298 | await watchUntilTrue(() => { |
| 299 | for (const note of this.react.notes) { |
| 300 | if (!note.react.loaded) { |
| 301 | return false; |
| 302 | } |
| 303 | } |
| 304 | |
| 305 | return true; |
| 306 | }); |
| 307 | await sleep(); |
| 308 | |
| 309 | mainLogger.sub('page.finishSetup').info('All notes loaded'); |
| 310 | |
| 311 | const elemId = |
| 312 | ((route().value.query.note ?? route().value.query.elem) as string) ?? |
| 313 | ''; |
| 314 | |
| 315 | if (isNanoID(elemId)) { |
| 316 | const elem = this.notes.fromId(elemId) ?? this.arrows.fromId(elemId); |
| 317 | |
| 318 | if (elem != null) { |
| 319 | this.selection.set(elem); |
| 320 | |
| 321 | const elemElem = |
| 322 | elem.type === 'note' |
| 323 | ? elem.getElem('note-frame') |
| 324 | : elem.getHitboxElem(); |
| 325 | |
| 326 | if (elemElem != null) { |
| 327 | scrollIntoView(elemElem, { |
| 328 | animate: false, |
| 329 | centerCamera: true, |
| 330 | }); |
| 331 | } |
| 332 | } |
| 333 | } |
| 334 | |
| 335 | this.camera.fitToScreen(); |
| 336 | |
| 337 | await sleep(); |
| 338 | } catch (error) { |
nothing calls this directly
no test coverage detected