Skip to content

JavaScript interop calls cannot be issued at this time - problem and solution #228

Description

@kkrysztofczyk

That code can be executed not correctly:

protected override async Task OnInitialized()
{
var window = await jsRuntime.Window();
}

In that case, you will get the error:

JavaScript interop calls cannot be issued at this time. This is because the component is being statically rendererd. When prerendering is enabled, JavaScript interop calls can only be performed during the OnAfterRenderAsync lifecycle method.

In most cases, it can be easily solved when we will move that to another method that is executed later.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions