mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #5628] [MERGED] fix(game): re-measure the HUD layout when its surface mounts #6854
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#6854
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/Pasta-Devs/Marinara-Engine/pull/5628
Author: @Romuromylus
Created: 8/29/2026
Status: ✅ Merged
Merged: 8/30/2026
Merged by: @Romuromylus
Base:
staging← Head:fix/5626-mobile-webkit-fixture-startup📝 Commits (7)
a446824fix(game): re-measure the mobile HUD when its surface mountsb1d5ca9Merge remote-tracking branch 'pasta/staging' into fix/5626-mobile-webkit-fixture-startupc9186actest(e2e): close the CYOA readiness guard's fail-open path206fa88Merge remote-tracking branch 'pasta/staging' into fix/5626-mobile-webkit-fixture-startupbf27812fix(game): re-measure the HUD layout when its surface mountse27d318test(e2e): budget the HUD compaction hold for a cold surface chunk1591041test(e2e): bound the frame wait in the HUD compaction hold📊 Changes
3 files changed (+215 additions, -3 deletions)
View changed files
📝
CHANGELOG.md(+1 -0)📝
e2e/core-flows.e2e.ts(+192 -0)📝
packages/client/src/components/game/GameSurface.tsx(+22 -3)📄 Description
Linked issue
Closes #5654
Why this change
This started as a fix for #5626's two flaky mobile WebKit tests. While it was in review, #5633 and #5618 landed and stabilised both of those tests on
staging, so I have dropped that work and re-scoped this PR onto the app-side defect the investigation turned up, which is still live.GameSurfacedecides its compact HUD layout in an effect keyed on[combatUiActive, normalizedWidgets.length]. That effect measureshudSurfaceRef.currentand attaches aResizeObserverto it. ButGameSurfacealso has an early return for its messages-loading branch, which mounts no surface at all, and the widget state hydrates from chat metadata (useSyncGameState) independently of the messages query. When the widget count lands while that branch is showing,updateWidgetLayoutfinds no element and returns, andconst surface = hudSurfaceRef.currentisnullso no observer is attached either. Neither dependency changes when the real surface mounts a moment later, so nothing re-measures for the rest of the session.#5618 changed that effect's reset from a flat
falsetowindow.innerWidth < 768. That leaves the stranded value correct on a phone, which is why the mobile CYOA test now passes either way, but it does not address the measurement or the missing observer. Every compact decision that depends on the overlap estimate rather than the width shortcut is still wrong.The visible result, at a tablet or narrow-desktop width, is that the desktop widget rails render on top of the dialogue and the compact choice stage never appears. Only a window resize recovers it, because the
windowresize listener is still registered andupdateWidgetLayoutre-reads the ref when called.Instrumenting the effect shows both orderings directly:
And at 900px on current
staging:What changed
packages/client/src/components/game/GameSurface.tsx: track the HUD surface node in state alongside the existing ref and add it to the layout effect's dependencies, so mounting the surface re-establishes both the measurement and theResizeObserver. The ref is kept because framer-motion consumes it asconstraintsRefin three places, and it is still assigned in the same commit-time ref phase, so drag-constraint resolution is unchanged. The messages-loading branch gets adata-component="GameSurface.MessagesLoading"marker, matching the convention already used across this file; no runtime selector reads it, every existingdata-componentconsumer matches an exact unrelated value.e2e/core-flows.e2e.ts: one new desktop case at 900px. It holds the first page of messages until the loading branch has committed, which pins the ordering rather than leaving it to runner timing, then asserts the branch was actually observed so the hold cannot silently degrade into a no-op, and finally requires the compact stage to be mounted with no desktop rails. 900px is the point of the case: it is past thewidth < 768shortcut, so the compact layout can only be reached by measuring.CHANGELOG.md: entry for the fix.Dropped from the earlier scope: the transcript-swipe change, since #5633 fixed that test upstream with a fresh page per fixture and that approach is better than mine (it does not depend on init-script evaluation order, which Playwright documents as undefined); and the guard I had added to the mobile CYOA test, since #5618's reset makes that case pass with or without this fix, so it no longer demonstrates anything.
Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
Being precise about what backs the ticks above, since two of them are Playwright-driven rather than hand-driven:
pnpm checkpasses (exit 0), as doespnpm version:check.--project=desktop-chromium --retries=0: fails 2/2 with the client fix reverted, reporting the rails rendered and no choice stage, and passes 3/3 with it.expected the Game messages-loading branch to render while the first page of messages was heldrather than passing quietly or timing out somewhere unrelated.mobile-webkitjob run locally earlier in this branch's life: 101 passed, 96 skipped, 0 failed.desktop-chromiumshards, all fourmobile-webkitshards, all threemobile-chromiumshards,complete-node-regressions,container-build-test,pnpm-validateand CodeQL. The container tick rests on thatcontainer-build-testjob; I did not build an image by hand.Things I would appreciate a second pair of eyes on:
Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)UI evidence (if applicable)
The failure is a layout state rather than an error, so the clearest evidence is the element counts above: at 900px the pre-fix build mounts two
[data-game-widget-rail]elements and noGameSurface.MobileChoiceStage, and the post-fix build mounts the stage and no rails.Notes for review
#5626can be closed as resolved by #5633 and #5618; its two tests are green onstagingand nothing in this PR touches them any more. I left it open rather than closing someone else's issue on my own read.The branch carries a merge of
staging(theCHANGELOG.mdconflict kept both entries, and thecore-flows.e2e.tsconflict was resolved in favour of #5633's version wholesale).Summary by CodeRabbit
Bug Fixes
Tests
Documentation
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.