( state: ReportState, updates: UIUpdate[], )
| 121 | * Apply handler-driven UI updates to a ReportState. |
| 122 | */ |
| 123 | export function applyUIUpdates( |
| 124 | state: ReportState, |
| 125 | updates: UIUpdate[], |
| 126 | ): ReportState { |
| 127 | let nextState = state |
| 128 | |
| 129 | for (const update of updates) { |
| 130 | if (update.type === 'update') { |
| 131 | nextState = applyUIEvent(nextState, { |
| 132 | op: 'update', |
| 133 | id: update.componentId, |
| 134 | props: update.props ?? {}, |
| 135 | }) |
| 136 | } else if (update.type === 'remove') { |
| 137 | nextState = applyUIEvent(nextState, { |
| 138 | op: 'remove', |
| 139 | id: update.componentId, |
| 140 | }) |
| 141 | } |
| 142 | } |
| 143 | |
| 144 | return nextState |
| 145 | } |
| 146 | |
| 147 | /** |
| 148 | * Apply refresh results from subscription invalidation. |
no test coverage detected