mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #298] [MERGED] fix: inject default viewport meta (width=device-width, initial-scale=1) #457
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#457
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/cloudflare/vinext/pull/298
Author: @Divkix
Created: 3/6/2026
Status: ✅ Merged
Merged: 3/6/2026
Merged by: @james-elicx
Base:
main← Head:fix/default-viewport-meta📝 Commits (3)
0a50fddfix: inject default viewport meta (width=device-width, initial-scale=1)4508f9erefactor: export DEFAULT_VIEWPORT and reuse at call sites71dcd5crefactor: simplify mergeViewport call sites to always apply defaults📊 Changes
3 files changed (+53 additions, -8 deletions)
View changed files
📝
packages/vinext/src/server/app-dev-server.ts(+4 -7)📝
packages/vinext/src/shims/metadata.tsx(+6 -1)📝
tests/features.test.ts(+43 -0)📄 Description
Fixes #299
Summary
mergeViewport()starts from an empty object{}, so when a user exports a viewport config with onlythemeColor(nowidth/initialScale), the merged result is truthy but missing viewport dimensionsViewportHeadthen skips the<meta name="viewport">tag entirely, breaking mobile rendering for any app that relies on Next.js's implicit viewport defaultsmergeViewportwithDEFAULT_VIEWPORTmatching Next.js'screateDefaultViewport():{ width: "device-width", initialScale: 1 }. User-provided values still override these defaults.Bug flow (before fix)
Test plan
mergeViewportunit tests confirming defaults are injected when not providedViewportHeadrenders<meta name="viewport">when onlythemeColoris providedbunx vitest run tests/features.test.ts)tsc --noEmitpasses🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.