anear-js-api 2.3.1 → 2.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1468,19 +1468,31 @@ const AnearEventMachineFunctions = ({
1468
1468
  return { ...s, liveDurationMs: (s.liveDurationMs || 0) + add, liveStartedAt: null }
1469
1469
  }
1470
1470
  }),
1471
- setLastRenderResult: assign(({ event }) => {
1471
+ setLastRenderResult: assign(({ context, event }) => {
1472
1472
  const output = event?.output ?? event?.data
1473
1473
  if (!output || typeof output !== 'object') {
1474
1474
  return {
1475
1475
  lastRenderResult: null,
1476
- participantActionLookup: {}
1476
+ participantActionLookup: context.participantActionLookup || {}
1477
1477
  }
1478
1478
  }
1479
- return {
1480
- lastRenderResult: output,
1481
- participantActionLookup: output.participantActionLookup && typeof output.participantActionLookup === 'object'
1479
+ const incomingLookup =
1480
+ output.participantActionLookup && typeof output.participantActionLookup === 'object'
1482
1481
  ? output.participantActionLookup
1483
1482
  : {}
1483
+ // Merge token maps by participant so a selective/private re-render does not
1484
+ // invalidate untouched participants' existing action tokens.
1485
+ // For participants present in this render batch, replace their token map
1486
+ // atomically with the fresh map generated during render.
1487
+ const participantActionLookup = {
1488
+ ...(context.participantActionLookup || {}),
1489
+ }
1490
+ Object.keys(incomingLookup).forEach((participantId) => {
1491
+ participantActionLookup[participantId] = incomingLookup[participantId]
1492
+ })
1493
+ return {
1494
+ lastRenderResult: output,
1495
+ participantActionLookup
1484
1496
  }
1485
1497
  }),
1486
1498
  notifyAppMachineRendered: ({ context }) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anear-js-api",
3
- "version": "2.3.1",
3
+ "version": "2.3.2",
4
4
  "description": "Javascript Developer API for Anear Apps",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {