-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect data handling without toArray in pipeline using flatMap #279
Comments
@ppeeou It needs to determine if the case where toArray is not used constitutes a bug. |
@HunSeol This is not a bug. Because you have consumed all of the Iterator in If you want to check, change the execution order as follows. const optionNamesWithoutArray = pipe(
checkedOptionsWithoutArray,
map((option) => option.name),
join('|')
);
const optionIdsWithoutArray = pipe(
checkedOptionsWithoutArray,
map((option) => option.id),
join('|')
); This is something to be careful of when using the iterator object. To achieve the intended result, you must use fork, but it is still under development. To obtain the desired result with the current specification, you can use |
Thank you for comment. I understood your intention.
Could you explain this comment more? How to store in memory using toArray? |
I have one more question. |
@HunSeol const checkedOptionsWithArray = pipe(
groups,
flatMap((group) => group.options),
filter((option) => option.checked),
toArray
);
const optionIdsWithArray = pipe(
checkedOptionsWithArray,
map((option) => option.id),
join('|')
);
const optionNamesWithArray = pipe(
checkedOptionsWithArray,
map((option) => option.name),
join('|')
);
Not yet, but I'll think about it. |
Bug Report
💻 Code
🙁 Actual behavior
When
toArray
is not used afterflatMap
andfilter
, the intermediate values are removed, resulting in an empty string foroptionNames
.optionIds
: "1|3|4"optionNames
: ""🙂 Expected behavior
Both
optionIds
andoptionNames
should correctly display the joined string of IDs and names of checked options, regardless of the use oftoArray
.optionIds
: "1|3|4"optionNames
: "name-1|name-3|name-4"Version Information
The text was updated successfully, but these errors were encountered: