Fix thumbnail quality and mobile vertical split layout
Build and Deploy Verso / deploy (push) Successful in 10m23s

Thumbnails: update the actual thumbnail endpoint (ConversionController.js
thumbnailFromBuild) to quality=90 and width=794. The previous fix targeted
ConversionManager.js which handles preview mode, not the thumbnail route
called by ThumbnailManager.mjs.

Mobile layout: move the isMobile guard before the stored-preference check
in getInitialLayout(). The autoSave race fix (build 274) stopped future
bad writes, but a stale 'flat' in localStorage was still being read on
every load, blocking the mobile check. Mobile now always starts in
verticalSplit regardless of any stored value.

CI: add node --check on all server-side .mjs files in the Dockerfile,
after source copy and before webpack compile, so syntax errors like the
escaped-backtick incident fail the build immediately.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
claude
2026-06-18 13:48:44 +00:00
parent 8a821bc91d
commit 8fc71d677c
3 changed files with 15 additions and 6 deletions
+7
View File
@@ -54,6 +54,13 @@ RUN --mount=type=cache,target=/root/.cache \
# Add the actual source files
# ---------------------------
COPY --parents libraries/ services/ tools/migrations/ /overleaf/
# Syntax-check all server-side ESM modules before the expensive webpack
# compile. node --check parses without executing, so it's fast and safe.
# Catches things like escaped backticks from sed substitutions that webpack
# never sees (it only bundles frontend code).
RUN find services/web/app/src services/web/modules -name '*.mjs' | xargs node --check
RUN --mount=type=cache,target=/root/.cache \
--mount=type=cache,target=/root/.yarn/berry/cache,id=server-ce-yarn-cache \
--mount=type=tmpfs,target=/usr/local/share/.cache/yarn \
+2 -2
View File
@@ -336,9 +336,9 @@ async function thumbnailFromBuild(req, res) {
'pdftocairo',
[
'-jpeg',
'-jpegopt', 'quality=82',
'-jpegopt', 'quality=90',
'-singlefile',
'-scale-to-x', '380',
'-scale-to-x', '794',
'-scale-to-y', '-1',
'-f', '1',
'-l', '1',
@@ -90,11 +90,13 @@ const MOBILE_MQ = '(max-width: 767px)'
function getInitialLayout(): IdeLayout {
const stored = localStorage.getItem('pdf.layout')
const isMobile = window.matchMedia(MOBILE_MQ).matches
// flat is the only preference respected on mobile — both 'split' and
// 'vertical' (which may have been stored from a desktop session) map to
// verticalSplit because side-by-side is unusable on a narrow screen.
if (stored === 'flat') return 'flat'
// On mobile, always start in verticalSplit (editor above, PDF below).
// We must check isMobile first: a stale 'flat' in localStorage (written by
// a previous autoSave race or a desktop session) would otherwise short-circuit
// the mobile check and leave the user stuck in a flat/editor-only layout.
// The user can still collapse to flat during a session, but it does not persist.
if (isMobile) return 'verticalSplit'
if (stored === 'flat') return 'flat'
if (stored === 'split') return 'sideBySide'
if (stored === 'vertical') return 'verticalSplit'
return 'sideBySide'