Skip to content

fix(wework): let fullscreen shell follow viewport - #2544

Merged
qdaxb merged 2 commits into
mainfrom
fix/wework-fullscreen-shell-size
Aug 10, 2026
Merged

qdaxb merged 2 commits into
mainfrom
fix/wework-fullscreen-shell-size

Conversation

@qdaxb

@qdaxb qdaxb commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • preserve native window sizing for Linux/WebKit startup stability
  • discard stale asynchronous resize conversions when a newer native resize arrives
  • handle native display scale-factor changes explicitly
  • add regression coverage for out-of-order resize completion

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 assigning
each conversion a monotonically increasing update number; only the newest
conversion may update React state.

Validation

  • Wework pre-push ESLint, TypeScript, and unit tests
  • Wework full Vitest suite: 335 files, 3240 tests
  • focused viewport/App tests: 3 files, 38 tests
  • Prettier and ESLint on changed files
  • isolated real-Tauri verification:
    • normal window: 1280 × 720
    • fullscreen viewport and app shell: 1728 × 1084
    • restored window: 1280 × 720

Related task: WEWORKC2FA61-95

Summary by CodeRabbit

  • Bug Fixes

    • Improved viewport sizing across window resize and scale-factor changes.
    • Prevented outdated or invalid size updates from overriding the latest dimensions.
    • Added safer handling when viewport information cannot be read.
  • Tests

    • Added coverage for resize events, scale-factor changes, initialization, and stale update handling.

@coderabbitai

coderabbitai Bot commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The PR moves Tauri viewport tracking from App.tsx into useTauriViewportSize. The hook handles scale-aware resize updates, stale asynchronous results, listener cleanup, and failure logging. Tests cover out-of-order resize conversions and updated Tauri mocks.

Changes

Tauri viewport sizing

Layer / File(s) Summary
Hook contract and initialization
wework/src/hooks/useTauriViewportSize.ts
Adds the ViewportSize interface and initializes viewport state from valid browser and Tauri dimensions.
Viewport conversion and listener lifecycle
wework/src/hooks/useTauriViewportSize.ts
Converts physical dimensions using the current scale factor, ignores stale or invalid results, manages resize and scale listeners, logs failures, and cleans up listeners.
App integration and validation
wework/src/App.tsx, wework/src/App.viewport.test.tsx, wework/src/App.apps.test.tsx, wework/src/App.plugins.test.tsx
AppShell imports the hook. Tests add scale-change mocks and verify that stale resize conversions cannot overwrite the latest viewport size.

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
Loading

Possibly related PRs

Suggested reviewers: micro66, icycrystal4, sdadunderscoresdad

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: fixing fullscreen shell sizing so it follows the viewport.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/wework-fullscreen-shell-size

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 lift

Remove the native viewport-size mirror.

Lines 682-689 override fixed inset-0 with 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 inline width and height style.
  • 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 uses fixed inset-0 without 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

📥 Commits

Reviewing files that changed from the base of the PR and between a6ab586 and 9471931.

📒 Files selected for processing (5)
  • wework/src/App.apps.test.tsx
  • wework/src/App.plugins.test.tsx
  • wework/src/App.tsx
  • wework/src/App.viewport.test.tsx
  • wework/src/hooks/useTauriViewportSize.ts

@qdaxb
qdaxb added this pull request to the merge queue Aug 10, 2026
Merged via the queue into main with commit 8ac7617 Aug 10, 2026
47 checks passed
@qdaxb
qdaxb deleted the fix/wework-fullscreen-shell-size branch August 10, 2026 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant