Hello, I was trying to update a sublist of a List, but I've not found a proper way to do this (using only one method).
Example : I have an Immutable cart with products and each products have a category and a price :
But with that, I only return products and not cart, so I have to merge... And sometimes I'm returning product without changes because it does not match my condition, it's not bad but not perfect right ?
From @lpeliberty on Tue, 26 Nov 2019 08:20:07 GMT
What happened
Hello, I was trying to update a sublist of a List, but I've not found a proper way to do this (using only one method). Example : I have an Immutable cart with products and each products have a category and a price :
If I want to return the whole cart, and update only product where category is
category1
, I can do a map + update, a filter + merge like :But with that, I only return products and not cart, so I have to merge... And sometimes I'm returning product without changes because it does not match my condition, it's not bad but not perfect right ?
Or with a updateInWhere for more complexe objects, It would be awesome for applications like react-redux (my use case).
Is it a bad idea ? Did I missed something in immutableJS docs that can do it ?
Thx to read.
Copied from original issue: https://github.com/immutable-js/immutable-js/issues/1752