ASP.NET MVC 5 : render partial view blocking the navigation

38 Views Asked by At

I am having a real headache issue that would like to see if anyone have any insights.

I'm using ASP.NET MVC 5 and C# and I'm trying to render a partial view inside a view.

The code to generate the partial view:

<div class="partialContents" data-url="/SignStatus/GetLiveSignImage/@Model.SignId">
    <img src="@Url.Content("~/Images/loader.gif")" alt="Loading..." title="Connecting to Sign..." />
</div>

Controller:

[HttpGet]
public async Task<ActionResult> GetLiveSignImage(int id)
{
    List<string> messages = new List<string>();
    // this represent a long wait task
    await Task.Delay(10000);

    var model = new MessageQueueViewModel() { SignId = id, QueuedMessages = messages };

    return this.PartialView("_MessageQuePartial", model);
}

While it is rendering the partial view, I have attempted to click on the menu bar to redirect to a different view and controller, but the UI is stuck until the partial view is fully rendered.

Checking the network tab in browser, I can observe that the GetLiveSignImage has to be finished (taking 10 seconds) before the redirect action can run.

I wonder if I am misconfiguring the Javascript or project somewhere and been spending a whole day for this.

0

There are 0 best solutions below