Consolidating the web services #148
Replies: 3 comments 3 replies
-
I think the changes this would require for our infrastructure are just:
|
Beta Was this translation helpful? Give feedback.
-
I think I'd be supportive of this. It'd reduce the amount of JS code we'd need to maintain which would be nice and would also make it easier to parse request logs in VLab if we need to. Being able to rely on Flask & the browser to handle back/forward buttons would be quite convenient. It sounds like preload links and/or service workers would be good ways to increase responsiveness if needed. On the infrastructure side:
|
Beta Was this translation helpful? Give feedback.
-
I’m embarking on an experiment in a branch to see how much this actually improves the frontend. |
Beta Was this translation helpful? Give feedback.
-
I’ve been thinking about making a change to the application architecture. Instead of having separate UI and API services, I think we might combine those two services into one services that is a more traditional web application.
We’d just need to add some routes to the existing Flask application that rendered some HTML for the UI, and we’d need to copy over some of the JavaScript from the UI service. We’d be able to eliminate some of the JavaScript and some of the build complexity in the UI this way. Instead of having to have Svelte components that generate the page layout, that’s handled by the server. We use our existing web components for the charts, but instead of being managed by Svelte, the server would just write out HTML with the appropriate attributes to produce the charts — that’s some state management we wouldn’t need to handle client-side anymore.
Currently, we don’t support back/forward buttons in the browser (but we need to). To do so in a client-side application like we have now, this means we have to implement routing with the history API or pull in another dependency that does that for us. Letting the Flask app handle HTTP requests for UI would mean the browser’s usual behavior would provide back/forward navigation for us, with only the cost of a full page refresh.
If we see some undesirable performance side effects from the full page refresh, we could likely address some of those by providing some preload links in the head of each HTML document the server generates, and building a service worker to help cache data.
Beta Was this translation helpful? Give feedback.
All reactions