fix: repair slide auto-sync in PowerPoint add-in#23
Conversation
The sessionData useEffect was overwriting the bridge-detected slide number with the stale DB value before the Convex mutation could complete. Since the bridge guards against re-reporting the same slide, the UI got stuck at the old value until an unrelated Convex push arrived. Fix: track bridge slide in separate state (bridgeSlide), derive lastKnownSlide as bridgeSlide ?? DB value. The DB value is now only used as fallback when the bridge has not yet reported anything (e.g. on initial load or after switching sessions). Also wrap getSlideCountAsync in try-catch to prevent a hanging Promise if the API is unavailable in certain Office.js environments. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe changes refactor how PowerPoint slide state is managed by introducing a bridge-sourced slide state that takes precedence over database values, with fallback to server state after session switches. Error handling is added to the Office Bridge's slide-count retrieval to gracefully handle synchronous exceptions. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Greptile SummaryThis PR fixes a race condition in the PowerPoint add-in where the displayed "Current Slide" would revert to slide 1 after switching slides in PowerPoint. The root cause was a Key changes:
Confidence Score: 5/5Safe to merge — the fix is correct, targeted, and introduces no new regressions. The race condition is accurately diagnosed and the fix is sound: making No files require special attention. Important Files Changed
Reviews (1): Last reviewed commit: "fix: repair slide auto-sync in PowerPoin..." | Re-trigger Greptile |
Problem
Die „Aktuelle Folie" im Add-in blieb auf 1 stehen, auch wenn man in PowerPoint auf Folie 2 wechselte.
Ursache
Ein
useEffectsynchronisiertelastKnownSlideständig mitsessionData.session.currentSlide(dem DB-Wert). Sobald die Bridge Folie 2 erkannte und die Convex-Mutation startete, konnte ein zwischenzeitliches Convex-Update den UI-Wert auf 1 zurücksetzen – bevor die Mutation abgeschlossen war. Da die BridgelastReportedSlide = 2gespeichert hatte, meldete sie Folie 2 nicht nochmal → UI blieb auf 1 hängen.Fix
bridgeSlide(nur von Bridge/Manualbuttons beschrieben)lastKnownSlideist jetzt ein derived value:bridgeSlide ?? DB-Wert ?? 1getSlideCountAsyncim officeBridge, um hängende Promises zu verhindern wenn die API nicht verfügbar istTest
🤖 Generated with Claude Code
Summary by CodeRabbit