fluence-js: fix particle data merging (#998)

This commit is contained in:
Dima
2020-12-14 15:21:43 +03:00
committed by GitHub
parent 8a10957efe
commit 7848f59e00
2 changed files with 6 additions and 4 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "fluence", "name": "fluence",
"version": "0.7.100", "version": "0.7.101",
"description": "the browser js-libp2p client for the Fluence network", "description": "the browser js-libp2p client for the Fluence network",
"main": "./dist/fluence.js", "main": "./dist/fluence.js",
"typings": "./dist/fluence.d.ts", "typings": "./dist/fluence.d.ts",

View File

@ -87,11 +87,13 @@ export class FluenceClient {
log.info("inner interpreter outcome:"); log.info("inner interpreter outcome:");
log.info(stepperOutcome); log.info(stepperOutcome);
// update data after aquamarine execution
let newParticle: Particle = {...particle};
newParticle.data = JSON.parse(stepperOutcome.call_path)
this.subscriptions.update(newParticle)
// do nothing if there is no `next_peer_pks` or if client isn't connected to the network // do nothing if there is no `next_peer_pks` or if client isn't connected to the network
if (stepperOutcome.next_peer_pks.length > 0 && this.connection) { if (stepperOutcome.next_peer_pks.length > 0 && this.connection) {
let newParticle: Particle = {...particle};
newParticle.data = JSON.parse(stepperOutcome.call_path);
await this.connection.sendParticle(newParticle).catch((reason) => { await this.connection.sendParticle(newParticle).catch((reason) => {
console.error(`Error on sending particle with id ${particle.id}: ${reason}`) console.error(`Error on sending particle with id ${particle.id}: ${reason}`)
}); });