[v16] Refactor client canvas and fix a race condition when closing RDP stream #52868
Merged
gzdunek merged 7 commits intobranch/v16from Mar 7, 2025
Merged
[v16] Refactor client canvas and fix a race condition when closing RDP stream #52868gzdunek merged 7 commits intobranch/v16from
gzdunek merged 7 commits intobranch/v16from
Conversation
* Remove non-canvas related listeners from `TdpClientCanvas` * Simplify event handlers setup by using React handlers * Listen to canvas resize events instead of window ones * Expose imperative API to set pointer * Expose imperative API to render frames * Expose imperative API to change canvas resolution Also, we no longer need to set the canvas size manually; it is now handled by `objectFit: scale-down`. * Remove duplicate player shutdown * Expose imperative API to clear canvas * Remove unnecessary display size syncing We get the canvas resolution from the server, there doesn't seem to be a need to calculate it from the browser window size. * Fix focusing canvas It didn't work because it happened too early, before we even showed the MFA dialog which stole focus. This is a temporary fix, I will do it more elegantly in the future. * Minor code changes Remove component memoization, it didn't work anyway and doesn't seem needed. We don't have anything particularly expensive to render here from React's perspective. * Add a TODO for improving rendering functions (cherry picked from commit 671475f)
…tream (#52714) * Add `useListener` hook that makes subscribing to events easier * Expose simpler APIs for subscribing to events * Replace verbose `useEffect` listeners with `useListener` calls * Fix a race condition that caused TDP errors to be overwritten with websocket close messages * Move `clientOnTdpWarning` to `DesktopCanvas.tsx` * Move `clientOnTdpInfo` to `DesktopCanvas.tsx` * Move `clientOnTdpError` to `DesktopCanvas.tsx` * Move functions that change WS connection status to `DesktopCanvas.tsx` * Change order of functions * Do not remove listeners when shutting down the WebSocket It's the responsibility of callers who created the listeners to clean them up. Otherwise, `onWsClose` callback won't be called when we call `shutdown()`. * Fix types (cherry picked from commit 0a7d941)
Contributor
Author
|
Snapshot test were failing for the Desktop Session story. Since we removed snapshots completely in v17, I have removed the failing one here as well. |
zmb3
approved these changes
Mar 6, 2025
avatus
approved these changes
Mar 7, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport #52431 to branch/v16
Backport #52714 to branch/v16
There were some conflicts, I tested the branch manually.
changelog: Resolved an issue where desktop session recordings could have incorrect proportions
changelog: Resolved an issue that could cause WebSocket errors to appear after the graceful shutdown of a desktop session