Weird behaviour when omitting .withId(...) on tags (JS/TS)

Hello everyone,

during an update I added an additional tag to a fish ‘where’ definition:


of: (orderId: string): Fish<OrderType, ProcessEvent> => ({
fishId: FishId.of(“productionOrders”, orderId, 0),
initialState: {} as OrderType,
where: processTag.withId(orderId),
onEvent: (state, event, { timestampAsDate }) => {


where: processTag.withId(orderId).or(BookingTags.erpBookingSuccess),

This led to some weird behaviour and a big delay in event processing.
Events took up to 20 seconds or longer to register and take effect.
We had a similar issue with delay in earlier stages of development.
At that time the problem had to do with object and array immutability.

However, I think this is not the case this time.
After some time tracking down the error we noticed that when we add ‘.withId’ to the process tag,
the delay went away:

where: processTag.withId(orderId).or(BookingTags.erpBookingSuccess.withId(orderId)),

Without ‘.withId(…)’, the application worked fine with fewer events, but once we tested with a heavier load, the delay was significant. But the application still behaved the same, it just took some time.

Right now we are unsure if we fixed the problem, or if this is just a sign to a bigger underlying problem.
Can someone explain this behaviour to me?

The query .withId(orderId) selects only the booking successes for a specific order while the variant without this call selects all booking successes, regardless of order ID. I’d expect the latter to take longer by a factor roughly given by the number of order IDs in your system, since a lot of confirmations will need to be handled for bookings that wouldn’t be done for this particular fish.

So the short answer is: .withId(orderId) is the correct way to do it, the other just wastes cycles (it would have worse effects if it wasn’t just booking successes, depending on your business logic).

IIRC, @KuettnerAutomationLM, you’re also still using Actyx v1. Is that correct?
If so, switching to v2 should make it significantly to select the matching events.

How can you tell which actyx version you are using?

As Actyx service we currently still use version 2.3.1.

These are our dependencies:
@actyx-contrib/actyx-http-connector”: “^1.0.2”,
@actyx-contrib/react-pond”: “^3.0.0”,
@actyx-contrib/registry”: “^3.0.0”,
@actyx/pond”: “^3.1.2”,

and the axp-settings:
“axpVersion”: “1.4.0”,
“pondVersion”: 3

The Actyx service version is the relevant one, so you are indeed using v2. Did my response answer your concern? In general, you should make the where clause as specific as you can to process the least amount of events — ideally only those that are necessary to compute the fish state.

Yes your answer helped alot, thank you the fast response.

You’re very welcome!