Is there a way to filter old entries from an array and only keep the new entries?
I have a flow that gets forum posts as an array. The array is then passed through filter node so only when array contains a new element it goes through the filter node. But the problem is that the whole array is passed forward. Which means that the next node that sends a notification for each post in an array ends up re-sending notifications for old entries.
One solution I can think of:
- Add a function node after the filter node.
- Within that function node use
context.set();
to store the previous version of the array. - Compare the new array to the one stored in context and filter out the old entries then pass this new filtered array forward to the notification sender.
Is that the right solution or is there a better/optimal way to achieve this?