fix(desktop): app zoom no longer zooms the preview browser #6649
Mergedjuliusmarmingemerged 2 commits into
main fromrefs/pull/6649/headmerged by juliusmarminge View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
- apps/desktop/src/preview/Manager.ts line 1720OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -1716,8 +1714,7 @@17161714 const annotationTheme = yield* Ref.get(annotationThemeRef);17171715 const currentAttachment = attached.get(webContentsId);17181716 if (tab.webContentsId === webContentsId && currentAttachment?.webContents === wc) {1719- const zoomFactor = yield* attempt(1720- { operation: "registerWebview.getZoomFactor", tabId, webContentsId },1721- () => wc.getZoomFactor(),1717+ yield* attempt({ operation: "registerWebview.restoreZoomFactor", tabId, webContentsId }, () =>1718+ wc.setZoomFactor(tab.zoomFactor),17221719 );1723- yield* update(tabId, { zoomFactor });1720+ yield* update(tabId, { zoomFactor: tab.zoomFactor });
- apps/desktop/src/preview/Manager.ts line 2121Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -2101,0 +2097,21 @@2097+ /**2098+ * Chromium hands every guest `<webview>` the embedder's zoom level, so zooming2099+ * the app UI drags the previewed page along with it. The preview browser owns2100+ * its own zoom factor, so re-assert it on each attached guest whenever the main2101+ * window's zoom changes (see DesktopWindow.zoomMain).2102+ */2103+ const reapplyZoom = Effect.fn("PreviewManager.reapplyZoom")(function* () {2104+ const tabs = yield* SynchronizedRef.get(tabsRef);2105+ yield* Effect.forEach(2106+ tabs.values(),2107+ (tab) => {2108+ if (tab.webContentsId === null) return Effect.void;2109+ const wc = webContents.fromId(tab.webContentsId);2110+ if (!wc || wc.isDestroyed()) return Effect.void;2111+ return attempt({ operation: "reapplyZoom", tabId: tab.tabId, webContentsId: wc.id }, () =>2112+ wc.setZoomFactor(tab.zoomFactor),2113+ ).pipe(Effect.ignore);2114+ },2115+ { discard: true },2116+ );2117+ });apps/desktop/src/preview/Manager.ts line 1720OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -1716,8 +1714,7 @@17161714 const annotationTheme = yield* Ref.get(annotationThemeRef);17171715 const currentAttachment = attached.get(webContentsId);17181716 if (tab.webContentsId === webContentsId && currentAttachment?.webContents === wc) {1719- const zoomFactor = yield* attempt(1720- { operation: "registerWebview.getZoomFactor", tabId, webContentsId },1721- () => wc.getZoomFactor(),1717+ yield* attempt({ operation: "registerWebview.restoreZoomFactor", tabId, webContentsId }, () =>1718+ wc.setZoomFactor(tab.zoomFactor),17221719 );1723- yield* update(tabId, { zoomFactor });1720+ yield* update(tabId, { zoomFactor: tab.zoomFactor });
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
juliusmarminge merged thisd8a6dfd
juliusmarminge closed this
Sign in to join this conversation.





Important
Review skipped#
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID:
ee8ebdca-8e83-4091-8a01-7db95afbeec9You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
Comment `@coderabbitai help` to get the list of available commands.