I want to append an item to a List deep inside another structure. Would ideally like:
pushIn(keyPath: Array<any>, value: T): List<T>
where the keyPath is one item shorter than an equivalent setIn would be (because the final operation is a push, not a set).
Thoughts?
There's a bit of a slippery slope where ultimately every API method will have an equivalent *In() parallel. pushIn() makes good sense, so I'll keep this open.
In the meantime, updateIn() is the generic deep update method which all other *In use directly.
foo.updateIn(["a", "b", "c"], List(), list => list.push(123));
The empty list 2nd arg will be used in place of undefined in the update fn should the path not yet exist.
Thank you for reporting this issue and appreciate your patience. We've notified the core team for an update on this issue. We're looking for a response within the next 30 days or the issue may be closed.
Has something been done for that issue?
bump
Most helpful comment
There's a bit of a slippery slope where ultimately every API method will have an equivalent *In() parallel. pushIn() makes good sense, so I'll keep this open.
In the meantime, updateIn() is the generic deep update method which all other *In use directly.
foo.updateIn(["a", "b", "c"], List(), list => list.push(123));
The empty list 2nd arg will be used in place of undefined in the update fn should the path not yet exist.