Micro:bit multiple "serial on data recieved" don't work properly (only the last one works)

Unless I’m doing something wrong here - when I use multiple serial.onDataReceived only the last one actually works. The serial.readString() I was using clearly shows that both the # and $ sign get sent over serial and get properly received, but only the LAST serial.onDataReceived with a . actually works.

https://youtu.be/2iKxum5Tk4A (I press each key at least 3 times)

Here’s the code ifrom the video:

serial.onDataReceived(serial.delimiters(Delimiters.Dollar), function () {
    basic.showLeds(`
        . . . . .
        . # . . .
        # # # # #
        . # . . .
        . . . . .
        `)
    basic.pause(1000)
    basic.clearScreen()
})
input.onButtonPressed(Button.AB, function () {
    serial.writeLine("A")
})
serial.onDataReceived(serial.delimiters(Delimiters.Hash), function () {
    basic.showLeds(`
        . . # # #
        . . # # #
        . . # # #
        . . . . .
        . . . . .
        `)
    basic.pause(1000)
    basic.clearScreen()
})
serial.onDataReceived(serial.delimiters(Delimiters.Fullstop), function () {
    basic.showIcon(IconNames.Sword)
    basic.pause(1000)
    basic.clearScreen()
})
basic.forever(function () {
    basic.showString(serial.readString())
})

Yes, I think you’re right. Looking at the code, each handler block overwrites the same delimiter string, and the same pointer to the event’s handler.

It’s the same for Bluetooth UART: https://forum.makecode.com/t/bluetooth-uart-command-to-move-servo-only-work-in-one-direction/29202

https://github.com/microbit-foundation/codal-core/blob/master/source/driver-models/Serial.cpp#L932