These are chat archives for jdubray/sam
actions.clearEditpresents data to the model which then mutates the state so that the data used to populate the input field is now blank.
both mutations in one "step"
I would say it depends, that's the benefit of the single state tree, you can carry multiple mutation as a unit-of-work. Nothing prevents you to create another unit of work. I do favor present methods that locally complete all mutations. A "step" (action/model/state) should be used meaningfully (e.g. in the rocket example, nap invokes the launch action when the counter is zero). It's really about automatic state transition, things that users (and therefore the view) can't do, because they are automatic, the model can't do, because that's an action.
focus, you're right, it's tricky. With React, you can use
autoFocus, and libraries like Snabbdom and Mithril have hooks:
focusproblem is a rare case where you need something from the markup.
Not sure, because in the end developers choose to code what they want, possible strategies to consider:
1/ offer both concepts (individual updates, units of work/state transition)
2/ make it more expansive (in the call signature) so people don't feel they could use it as a setter
actions.clearEdit(); looks too much like a function call/setter. Actions should always have an argument. Consider a dispatcher pattern to enforce that rule.
Apologies for bragging, I spent a lot of energy in the work I published over the last 15 years. This is the email I received today:
I saw that you have RSVPed for SeattleJS Hack night on this coming Monday. I was wondering if you are committed to attend? I would really like to meet you and I was frankly shocked to see your name on the roster because I respect your work on SAM architecture. I read over the website and have been studying for months now whenever I find the time. I live in the east side so it's quite a Lyft/Uber ride and commitment to go to the Metrix location in Broadway. Please let me know if you are going or might possibly not attend.