Samuel
@samuel.fm
go for it. break a leg.
1 3kinda feel like the real bug is this pattern
1 7what part? we need a function that does 2 things
1. filter out deleted messages
2. provide the next message, for the UI to use
I'm curious what you'd do differently
2 2I guess you could just use a gauge clause inside the map and drop the filter?
1 1what's a gauge clause? 😅
1 1Sorry, I meant *guard clause 🙈
1 1oh right haha
so what, return null or something and then filter out afterwards?
1Would be an option, but wouldn't improve performance.
You could use reduce() instead: stackoverflow.com/questions/24...
Or use a normal loop.
Performance is not an issue here and reduce is wildly more unreadable and bug prone. Avoid reduce where possible imo unless you have a specific need
> Or use a normal loop.
i was waiting for someone to say that
you don't have a function that needs to do two things, you have two distinct problems to solve and a stack of code that hides bugs and performance issues
1 8That is the correct criticism yep. would’ve sidestepped this bug completely
1 2sometimes i stop shitposting long enough to be coherent
1 4Why not return each undeleted item with their next companion deleted or not?
The exception raised when the last item is not deleted is a feature, not a bug.
No specs, no bug.