If, in a (React-based) web application, I want to fill a selection dropdown list that's content is determined by some backend (Spring Boot) logic depending on input from the UI, e.g.
filterOptions(x) return (x < 0) ? [1,2,3] : [4,5,6];
The dialog is not opened very often and the client/server communication overhead is neglectable as it is a LAN-based application. I have two approaches in mind:
1) We could build a backend endpoint that is to be queried whenever the user opens the dialog.
2) We could build a more generic endpoint to fetch the filter ruleset and build the filter in the Frontend.
3) ?
IMO, 1) is not an ideal approach because it clutters the api with these filter endpoints and couples front- and backend too much while 2) is not much better couplewise and is still weird to implement.
How would you implement this, what questions would you ask to determine which approach is more suited?
Aucun commentaire:
Enregistrer un commentaire