fix(mobile-ux): guard ScrollToTopAsync JS interop to prevent prerendering runtime error

This commit is contained in:
2026-06-05 20:00:31 +02:00
parent d36948b853
commit 12d701cb84
@@ -432,9 +432,17 @@
{
try
{
// Ensure the JS module is loaded and the component is fully rendered before invoking interop.
if (!_isJsInitialized)
{
await InitViewportDetectionAsync();
}
var module = await EnsureViewportModuleAsync();
if (module != null)
{
await module.InvokeVoidAsync("scrollToTop", ".reader-canvas");
}
}
catch (Exception ex)
{
Logger.LogWarning(ex, "Failed to scroll reader canvas to top.");