andymaul123 / pca-engine

Learning htmx and servers
0 stars 0 forks source link

Better Update Flow #12

Open andymaul123 opened 3 months ago

andymaul123 commented 3 months ago

The current paradigm, as describing in the Architecture Overview docs, works okay for linear flows. When only one area of the app needs to be updated, HTMX makes it easy.

The issue is, as app complexity increases, there is a need for one server response to update many parts of the client. An example would be transitioning to a scene, having the background music change, and editing the player inventory.

Design a new system that is more robust for "multi-channel" updates.

andymaul123 commented 3 months ago

As a starting idea, the server could return data to a "master view". Based on the data present, conditionals in the view would/would not render using HTMX out-of-band. Essentially, the master view could, if given the requisite data, update every part of the client at once.

andymaul123 commented 3 months ago

Another could be configuring the routes so the client accesses them in the same way as they do now, as "game actions". The server, however, could redirect to "internal routes" designed to update specific groupings of the app. Example: scene transition route that pipes the data into a specific partial that updates the background music, scene, and player inventory.