fix: correct slide detection for PowerPoint Online#27
Conversation
PowerPoint.run + getSelectedSlides() returns wrong data in Online (always slide 1). getSelectedDataAsync(SlideRange) is the correct primary API for both Online and Desktop. - getSelectedDataAsync is now PRIMARY for all platforms - PowerPoint.run + getSelectedSlides kept as Desktop-only fallback (skipped in Online via Office.PlatformType.OfficeOnline check) - getSlideCount extracted as helper to avoid code duplication 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 (1)
📝 WalkthroughWalkthroughModified the PowerPoint Office Bridge's slide detection and initialization flow. Added online/offline detection via Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Greptile SummaryThis PR fixes slide detection for PowerPoint Online by promoting Key changes:
Critical issue found:
Minor issues:
Confidence Score: 2/5Not safe to merge as-is — the primary detection path introduced in this PR reports slide numbers that are consistently off by one on every platform. The fix's intent is correct and the architectural restructuring (promoting apps/web/src/lib/powerpoint/officeBridge.ts — specifically line 186-187 (off-by-one on slide index) Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[syncCurrentSlide called
via poll / event / blur] --> B[getCurrentSlideInfo]
B --> C{isInitialized &&
isOfficeAvailable?}
C -- No --> D[resolve null]
C -- Yes --> E[getSelectedDataAsync
SlideRange PRIMARY]
E --> F{status !== Failed
&& slides.length > 0?}
F -- Yes --> G["slideNumber = slides[0].index + 1
⚠️ BUG: index is 1-based,
should NOT add 1"]
G --> H[getSlideCountAsync]
H --> I[resolve OfficeSlideInfo]
F -- No --> J{isOnline?}
J -- Yes / API missing --> D
J -- No --> K[powerPointRunGetSlide
Desktop fallback]
K --> L[PowerPoint.run +
getSelectedSlides]
L --> M[id-based indexOf lookup
then idx + 1]
M --> I
|
| const slideNumber = slides[0].index + 1; // index is 0-based | ||
| getSlideCount(presentationTitle, slideNumber, resolve); |
There was a problem hiding this comment.
slides[0].index is 1-based, not 0-based — slide number is off by 1
The code comment says "index is 0-based" and adds + 1, but the Microsoft Office.js documentation explicitly states:
"The
indexvalue of the slide is the 1-based value the user sees beside the slide in the thumbnails pane."
So for slide 3, slides[0].index returns 3, and 3 + 1 = 4 — one slide ahead of the actual position. This means the primary detection strategy (which is supposed to fix the PowerPoint Online bug) will always report the wrong slide number on every platform.
| const slideNumber = slides[0].index + 1; // index is 0-based | |
| getSlideCount(presentationTitle, slideNumber, resolve); | |
| const slideNumber = slides[0].index; // index is 1-based |
Problem
In PowerPoint Online (SharePoint/OneDrive) blieb die angezeigte Folie dauerhaft auf 1.
Ursache:
PowerPoint.run()+getSelectedSlides()gibt in PowerPoint Online immer Folie 1 zurück, unabhängig davon welche Folie gerade angezeigt wird. Diese Methode war bisher als primäre Strategie eingestellt.Fix
getSelectedDataAsync(CoercionType.SlideRange)ist jetzt die primäre Methode für alle Plattformen — funktioniert in Online zuverlässig und in Desktop wenn Fokus auf der Präsentation liegtPowerPoint.run()+getSelectedSlides()nur noch als Desktop-Fallback (wird in Online viaOffice.PlatformType.OfficeOnlineCheck übersprungen)DocumentSelectionChangedHandler — liest sofort, solange die Folie noch aktiv istNach dem Merge
Taskpane in PowerPoint Online schließen und neu öffnen — kein Manifest-Re-Download nötig.
🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes
Bug Fixes