My program makes a http call every x seconds and displays the formatted results in a table. Currently, the loop that makes the http call lives in the backend code and it emits the response as an event that the FE listens to. The loop is started and stopped by commands from the FE. The time between calls is a setting of my program and it's managed by Tauri manages as state (with commands for the FE to get and set it).
I did it like this because I thought it would be best to put as much logic as possible in the BE code but I wonder now if this is really the best approach. For example, if I want to display a "time since last update" in the UI I need to either create a new event so that the BE send this info to the FE (messy) or let the FE compute this based on the time since the last event (indirect). The alternative would be to put the update loop and the state management in the FE and have the BE only expose commands for IO. Most FE frameworks have some sort of state management solution so this might be easier to work with because it reduces the need for state synchronization.
In my case I think either option would be good enough but it makes me wonder more generally what best practices are for dividing logic between FE and BE code.