If the tasks dashboard or anything on it is customized, and the customization fires the 'document-updated' event, the refresh function does not redirect properly.
A good way to solve this would be to add another 'else if' to the refresh function:
that checks if 'this' is a task, and loads the task page (same way it would load 'browse' for regular docs)
As an example of how this would work, add a button to 'nuxeo-tasks' or 'nuxeo-document-task':
with this js function
Clicking the button should refresh the tasks page, not redirect to home.