Skip to content

fix(lifecycle): Ensure layout realization states remain monotonic#48

Closed
google-labs-jules[bot] wants to merge 1 commit into
mainfrom
fix/lifecycle-load-monotonicity-3378912116509574605
Closed

fix(lifecycle): Ensure layout realization states remain monotonic#48
google-labs-jules[bot] wants to merge 1 commit into
mainfrom
fix/lifecycle-load-monotonicity-3378912116509574605

Conversation

@google-labs-jules

Copy link
Copy Markdown
Contributor

Observed Problem:
Layout realization states (the properties typically bound to x:Load in the UI, such as ShouldLoadActiveConversationRoot and ShouldLoadTranscriptSurface) were regressing to false when temporary blocking overlays (e.g., during history hydration or rapid session switching) became visible. This caused the visual tree to be destroyed and re-created, leading to lost state (like scroll position) and wasted CPU cycles.

Root Cause:
In ChatConversationSurfaceProjectionCoordinator.cs, the ShouldLoad... properties were directly mirroring their ShouldShow... counterparts. Since ShouldShow... correctly becomes false when a blocking mask is active, the ShouldLoad... properties also became false, effectively un-loading the UI elements instead of just hiding them.

Why the Fix is Safe Architecturally:
The fix is tightly encapsulated within the ChatConversationSurfaceProjectionCoordinator. By introducing boolean latches (_hasLoadedActiveConversationRoot and _hasLoadedTranscriptSurface), the coordinator now ensures that once these elements are instructed to load, their ShouldLoad status remains monotonically true. This perfectly decouples layout realization (x:Load) from visual state visibility (Visibility), aligning with Uno/WinUI lifecycle best practices. No native controls are overridden, and no business rules have been leaked into the View or code-behind.

Verification Commands Run:

dotnet build src/SalmonEgg.Presentation.Core/SalmonEgg.Presentation.Core.csproj --configuration Debug
dotnet test tests/SalmonEgg.Presentation.Core.Tests/SalmonEgg.Presentation.Core.Tests.csproj --configuration Debug --no-restore

Remaining Unverified GUI-Only Risks:
Since the fix alters the x:Load lifecycle purely via ViewModel projections, the actual memory retention and visual performance impact when switching heavily populated chats relies on Uno Platform's underlying x:Load behavior. While structurally safe, specific platform rendering nuances during repeated hide/show cycles are not fully covered by the core unit tests.


PR created automatically by Jules for task 3378912116509574605 started by @YoungSx

The layout realization properties (`ShouldLoadActiveConversationRoot` and
`ShouldLoadTranscriptSurface`) were incorrectly mirroring their corresponding
`ShouldShow` properties. This caused the visual tree to unload when a
temporary blocking overlay appeared (e.g., during rapid session switching
or history hydration), losing UI state such as scroll position and wasting
CPU cycles upon recreation.

This commit updates `ChatConversationSurfaceProjectionCoordinator` to track
the historical loaded state. Once the load state evaluates to `true`, it
latches and remains `true` (monotonic), while the `ShouldShow` property
continues to correctly manage visibility without destroying the underlying
visual tree.

Tests in `ChatConversationSurfaceProjectionCoordinatorTests` and
`ChatViewModelTests` have been updated to reflect and verify this new
monotonic behavior.
@google-labs-jules

Copy link
Copy Markdown
Contributor Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@vercel

vercel Bot commented May 23, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
salmonegg Ready Ready Preview, Comment May 23, 2026 10:51pm

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@YoungSx

YoungSx commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Closing during PR triage: this is a stale or duplicate layout-loading monotonicity attempt. #49 is the clean green candidate for this behavior; this PR is superseded, failing/conflicting, or mixed-scope and should not be merged as-is.

@YoungSx YoungSx closed this Jun 25, 2026
@google-labs-jules

Copy link
Copy Markdown
Contributor Author

Closing during PR triage: this is a stale or duplicate layout-loading monotonicity attempt. #49 is the clean green candidate for this behavior; this PR is superseded, failing/conflicting, or mixed-scope and should not be merged as-is.

Understood. Acknowledging that this work is now obsolete and stopping work on this task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant