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,8 +432,16 @@
{ {
try try
{ {
// Ensure the JS module is loaded and the component is fully rendered before invoking interop.
if (!_isJsInitialized)
{
await InitViewportDetectionAsync();
}
var module = await EnsureViewportModuleAsync(); var module = await EnsureViewportModuleAsync();
await module.InvokeVoidAsync("scrollToTop", ".reader-canvas"); if (module != null)
{
await module.InvokeVoidAsync("scrollToTop", ".reader-canvas");
}
} }
catch (Exception ex) catch (Exception ex)
{ {