(update: WaveObjUpdate)
| 255 | } |
| 256 | |
| 257 | function updateWaveObject(update: WaveObjUpdate) { |
| 258 | if (update == null) { |
| 259 | return; |
| 260 | } |
| 261 | const oref = makeORef(update.otype, update.oid); |
| 262 | const wov = getWaveObjectValue(oref); |
| 263 | if (update.updatetype == "delete") { |
| 264 | console.log("WaveObj deleted", oref); |
| 265 | globalStore.set(wov.dataAtom, { value: null, loading: false }); |
| 266 | } else { |
| 267 | if (!isValidWaveObj(update.obj)) { |
| 268 | console.log("invalid wave object update", update); |
| 269 | return; |
| 270 | } |
| 271 | const curValue: WaveObjectDataItemType<WaveObj> = globalStore.get(wov.dataAtom); |
| 272 | if (curValue.value != null && curValue.value.version >= update.obj.version) { |
| 273 | return; |
| 274 | } |
| 275 | console.log("WaveObj updated", oref); |
| 276 | globalStore.set(wov.dataAtom, { value: update.obj, loading: false }); |
| 277 | } |
| 278 | return; |
| 279 | } |
| 280 | |
| 281 | function updateWaveObjects(vals: WaveObjUpdate[]) { |
| 282 | for (const val of vals) { |
no test coverage detected