Repository navigation
fix(wework): let fullscreen shell follow viewport - #2544
Conversation
📝 WalkthroughWalkthroughThe PR moves Tauri viewport tracking from ChangesTauri viewport sizing
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant AppShell
participant useTauriViewportSize
participant TauriWindow
AppShell->>useTauriViewportSize: request viewport size
useTauriViewportSize->>TauriWindow: read size and scale factor
TauriWindow-->>useTauriViewportSize: return physical dimensions
TauriWindow-->>useTauriViewportSize: emit resize or scale change
useTauriViewportSize-->>AppShell: return logical dimensions
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
wework/src/App.tsx (1)
682-689: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy liftRemove the native viewport-size mirror.
Lines 682-689 override
fixed inset-0with asynchronously derived logical dimensions. Those dimensions can be stale after the WebView enters fullscreen or changes size. This preserves the blank-space failure that this PR must fix.
wework/src/App.tsx#L682-L689: Remove the inlinewidthandheightstyle.wework/src/hooks/useTauriViewportSize.ts#L9-L77: Delete the obsolete hook.wework/src/App.tsx#L455-L455: Remove the hook call and its import.wework/src/App.viewport.test.tsx#L44-L73: Delete the test for obsolete asynchronous conversion behavior.wework/src/App.apps.test.tsx#L32-L39: Remove hook-specific Tauri window mocks.wework/src/App.apps.test.tsx#L309-L311: Assert that the shell usesfixed inset-0without inline dimensions.wework/src/App.plugins.test.tsx#L28-L35: Remove hook-specific Tauri window mocks.As per coding guidelines, “remove obsolete paths, and fix the primary flow rather than hiding defects behind fallbacks.”
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@wework/src/App.tsx` around lines 682 - 689, Remove the asynchronous native viewport-size mirror: in wework/src/App.tsx:682-689 remove the inline dimensions, and at wework/src/App.tsx:455 remove the useTauriViewportSize call and import; delete the obsolete hook in wework/src/hooks/useTauriViewportSize.ts:9-77. Delete the obsolete conversion test in wework/src/App.viewport.test.tsx:44-73, remove hook-specific mocks in wework/src/App.apps.test.tsx:32-39 and wework/src/App.plugins.test.tsx:28-35, and update wework/src/App.apps.test.tsx:309-311 to assert the shell retains fixed inset-0 without inline dimensions.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@wework/src/App.tsx`:
- Around line 682-689: Remove the asynchronous native viewport-size mirror: in
wework/src/App.tsx:682-689 remove the inline dimensions, and at
wework/src/App.tsx:455 remove the useTauriViewportSize call and import; delete
the obsolete hook in wework/src/hooks/useTauriViewportSize.ts:9-77. Delete the
obsolete conversion test in wework/src/App.viewport.test.tsx:44-73, remove
hook-specific mocks in wework/src/App.apps.test.tsx:32-39 and
wework/src/App.plugins.test.tsx:28-35, and update
wework/src/App.apps.test.tsx:309-311 to assert the shell retains fixed inset-0
without inline dimensions.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 494e934a-8639-44e3-92e3-43750adcf150
📒 Files selected for processing (5)
wework/src/App.apps.test.tsxwework/src/App.plugins.test.tsxwework/src/App.tsxwework/src/App.viewport.test.tsxwework/src/hooks/useTauriViewportSize.ts
Summary
Root cause
The app shell converts Tauri physical window sizes to logical CSS sizes. macOS
fullscreen emits a sequence of resize updates, and each conversion previously
awaited the scale factor without guarding against out-of-order completion. An
older conversion could therefore overwrite the final fullscreen size, leaving
blank space on the right and bottom.
The native size mirror cannot simply be removed: Linux WebKit under Xvfb can
start with a one-pixel CSS viewport even though the native window is
1280 × 720. The fix keeps native sizing as the source of truth while assigningeach conversion a monotonically increasing update number; only the newest
conversion may update React state.
Validation
1280 × 7201728 × 10841280 × 720Related task: WEWORKC2FA61-95
Summary by CodeRabbit
Bug Fixes
Tests