| 503 | let pendingPreviewConfigUpdate: PreviewConfigUpdate | null = null; |
| 504 | |
| 505 | const flushPreviewConfigUpdate = async () => { |
| 506 | if (previewConfigUpdateInFlight) return; |
| 507 | const next = pendingPreviewConfigUpdate; |
| 508 | if (!next) return; |
| 509 | |
| 510 | pendingPreviewConfigUpdate = null; |
| 511 | previewConfigUpdateInFlight = true; |
| 512 | |
| 513 | try { |
| 514 | await commands.updateProjectConfigInMemory( |
| 515 | next.config, |
| 516 | next.frameNumber, |
| 517 | FPS, |
| 518 | next.resolutionBase, |
| 519 | ); |
| 520 | } catch (e) { |
| 521 | console.error( |
| 522 | "[Editor] doConfigUpdate - ERROR sending config to Rust:", |
| 523 | e, |
| 524 | ); |
| 525 | } finally { |
| 526 | previewConfigUpdateInFlight = false; |
| 527 | if (pendingPreviewConfigUpdate) void flushPreviewConfigUpdate(); |
| 528 | } |
| 529 | }; |
| 530 | |
| 531 | const doConfigUpdate = (time: number) => { |
| 532 | pendingPreviewConfigUpdate = { |