tiny-pilot / tinypilot

Use your Raspberry Pi as a browser-based KVM.
https://tinypilotkvm.com
MIT License
3.02k stars 252 forks source link

Unify initialization procedure of dialogs #1773

Closed jotaen4tinypilot closed 1 month ago

jotaen4tinypilot commented 6 months ago

Originated in https://github.com/tiny-pilot/tinypilot/issues/1770.

The initialization process is basically the same in all our dialogs:

  1. We trigger one operation to initialize the dialog.
    • We often (but don’t always) have a method called .initialize() for this, which is implemented in the respective dialog. In some cases, the method is called differently, but that can be seen as accidental naming inconsistency.
  2. We call .show()

It makes sense for these two things to occur in the stated order, to avoid temporary view state artifacts to flicker when the user opens the dialog.

Considering the amount of dialogs we have, and that they all essentially work in the same way, we could consolidate the flow, and encode a unified initialization process in the code.

Potential Solution

We use an event-based flow:

I believe the work items for that would be these: