Skip to content

Commit 92dfb49

Browse files
ViewHandler: Skip null ToolTip initialization (#37842)
<!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ## Description Skips the platform ToolTip update while a new handler is connecting when the virtual view has the default `null` ToolTip. Reconnects still execute the update so a reused platform view can clear stale state. Dynamic non-null and null updates are unchanged. ## Benchmark The local Sandbox harness is not included in this PR. Release iOS simulator, iPhone 16 Pro / iOS 18.4: | Metric | Result | |---|---:| | Heavy tile `ToPlatform` (55 elements) | 12.771 ms | | Flat tile `ToPlatform` (14 elements) | 4.844 ms | | ToolTip mapper activity, 480 initial handlers | 0.236 ms | The mapper activity count remains 480 because attribution wraps the mapper entry even when the new guard returns immediately. This micro-optimization is below end-to-end simulator noise and no aggregate speedup is claimed. The run completed all 70 benchmark results with `run-end|ok`. ## Review Independent GPT, Claude, and Gemini reviews traced connection, reconnect, null/default values, dynamic updates, custom implementations, and all platform paths. All three found the guard safe and consistent with existing connect-time mapper guards. Copilot-Session: 5a03e13d-1a41-4652-a8c6-099eeb79cd50
1 parent c127c3f commit 92dfb49

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/Core/src/Handlers/View/ViewHandler.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,14 @@ public static void MapToolTip(IViewHandler handler, IView view)
655655
{
656656
#if PLATFORM
657657
if (view is IToolTipElement tooltipContainer)
658+
{
659+
if (handler.IsConnectingHandler() && tooltipContainer.ToolTip is null)
660+
{
661+
return;
662+
}
663+
658664
handler.ToPlatform().UpdateToolTip(tooltipContainer.ToolTip);
665+
}
659666
#endif
660667
}
661668

0 commit comments

Comments
 (0)