()
| 245 | // }) |
| 246 | |
| 247 | const addStackToRestSS = () => { |
| 248 | for (const item of stack) { |
| 249 | const client = item.id.client |
| 250 | const inapplicableItems = clientsStructRefs.clients.get(client) |
| 251 | if (inapplicableItems) { |
| 252 | // decrement because we weren't able to apply previous operation |
| 253 | inapplicableItems.i-- |
| 254 | restStructs.clients.set(client, inapplicableItems.refs.slice(inapplicableItems.i)) |
| 255 | clientsStructRefs.clients.delete(client) |
| 256 | inapplicableItems.i = 0 |
| 257 | inapplicableItems.refs = [] |
| 258 | } else { |
| 259 | // item was the last item on clientsStructRefs and the field was already cleared. Add item to restStructs and continue |
| 260 | restStructs.clients.set(client, [item]) |
| 261 | } |
| 262 | // remove client from clientsStructRefsIds to prevent users from applying the same update again |
| 263 | clientsStructRefsIds = clientsStructRefsIds.filter(c => c !== client) |
| 264 | } |
| 265 | stack.length = 0 |
| 266 | } |
| 267 | |
| 268 | // iterate over all struct readers until we are done |
| 269 | while (true) { |
no test coverage detected
searching dependent graphs…