links icon indicating copy to clipboard operation
links copied to clipboard

Redirect command in MVU

Open SimonJF opened this issue 1 year ago • 1 comments

It's often the case that we want to change page as a result of, say, clicking a button in an MVU application. Currently we just use redirect directly as Links is impure, but this isn't a particularly idiomatic way of doing things and has led to a weird race condition in a student project.

This patch introduces a Redirect command, which can be accessed through MvuCommands.changePage(url). The redirect is then processed in the MVU event loop as would be expected.

SimonJF avatar Feb 16 '24 15:02 SimonJF

Thanks @dhil. Agreed in general — although since this is in MVU it will run on the client and therefore use the jslib implementation of redirect (which I think uses document.url to perform the redirect).

SimonJF avatar Mar 06 '24 15:03 SimonJF