In your design, the port has a 1-to-1 connection to the Part.
The port does not communicate for which Part the incoming message is 
intended, because it "expects" that their is only 1 Part.

Your batch function in the subscriptions in the Group.elm passes on the 
port message on to all your Parts.
Your port receives one message of type `PortMsg (Some, Values)`.
The Group subscription function effectively turns this into 10 messages of 
type `PartMsg 0 PortMsg (Some, Values)` etcetera.
And passes each on Group update function.
So all parts respond to the one message.

You could:

   - refactor your port, to provide also an Int id of the intended Part to 
   receive the message
   - subscribe to this port ONLY in Group
   - that would also mean you need to change code in JavaScript-land, to 
   provide the Id when sending info to Elm

Or:

   - store an `activePart: Int`  in your Group model, so your Group update 
   knows to which single Part the message should go
   - subscribe to the (unchanged) port in your Group subscriptions only 
   (without bundling the subscriptions of each of the Parts)

Or other options.
But that depends very much on what you want to achieve. The terms 'Part' 
 and 'Group' are quite generic, and it is unknown what happens at the other 
end of the port.
Maybe you could elaborate on what you want to achieve?


-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to