Skip to content Skip to sidebar Skip to footer

In Scala Or Scalajs Diode, Do Any Of The Existing Types Line Up With The Use Case Of "updating A Model That Doesn't Yet Exist"?

Here's a common situation: you have a form and you're interested in the submissions of that form. You may add a wrinkle to the situation by adding a server-side validator, or even

Solution 1:

This may be something where using a chat would work better, but here are some thoughts on the matter.

There are three places you could store such an event log:

  1. In the state of the view component. Just add the timestamped events to a list stored in the view state. On submission, send this list alongside with the rest of the data.

  2. In the Diode model. Again, store a list of events in the model and submit with the form data.

  3. In the server. Send each event separately to the server and let it worry about what they mean. No need to store on client side at all.

For such transient data, I wouldn't route it through Diode at all, but instead use options 1 or 3 to transmit it.

Post a Comment for "In Scala Or Scalajs Diode, Do Any Of The Existing Types Line Up With The Use Case Of "updating A Model That Doesn't Yet Exist"?"