Josh
Josh

Reputation: 7602

Handling load timeouts of a view in a Durandal app

I've got a Durandal app that will periodically timeout when attempting to load a view. Here's an example timeout error:

Error: Load timeout for modules: text!views/primaryapplicants.html
http://requirejs.org/docs/errors.html#timeout

If you lookup the provided URL, it suggests a few possible issues:

None of these are my issue. It is a real, genuine timeout. For some reason it wasn't able to load the view file.

There is some RequireJS documentation on handling errors... but after reading it a number of times, I still can't figure out how to trap for a load timeout on my view module.

Ideally, what I would like to do is either a) extend the timeout or b) give the user a notification and allow them to try loading the view again.

What's happening right now is that the view simply fails to load and the user gets no feedback that there was an error--the "please wait, loading" dialog disappears because the AJAX request finished, but the view doesn't change.

Upvotes: 3

Views: 1169

Answers (1)

Hans
Hans

Reputation: 117

I sometimes have the same issue. For me, it usually happens when another asynchronous request is blocking the server (that can handle only one request at a time on my dev machine) and a view is requested.

I don't know yet how to catch this, but in order to increase/disable the timeout:

requirejs.config({
    waitSeconds: 0 // 0 disables the timeout completely, default is 7 seconds
});

Upvotes: 6

Related Questions