Overview

UIX

⚠️ Attention: This is not the latest version of the documentation.

Utility Functions

The redirect function

We recommend using the redirect utility function when redirecting to a new page, instead of setting window.location.href directly.

The redirect function guarantees that all scheduled DATEX updates are sent before leaving the current page. This prevents inconsistencies for shared pointer values:

// safe navigation to "/home"
redirect("/home"); 

This is equivalent to

// wait until all scheduled DATEX updates are sent
await Datex.Runtime.synchronized; 
// navigate to "/home"
window.location.href = "/home"

The redirect function is available in the global scope per default, but can also be imported from "uix/utils/window-apis.ts".

Note

The redirect function can only be used on the frontend. If you want to redirect during backend routing, use the provideRedirect function

Did this doc help you?

Privacy Policy

Help us improving our docs

Our documentations are fully open source. Something is wrong or unclear?

Make a contribution