node-red-quantum / node-red-contrib-quantum

Quantum computing functionality for Node-RED
https://node-red-quantum.github.io/
Apache License 2.0
16 stars 2 forks source link

quantumCircuit object in global state not being properly updated #97

Closed bbaayezi closed 3 years ago

bbaayezi commented 3 years ago

Bug Description

quantumCircuit object in the global state manager wasn't being updated correctly. Related lines: https://github.com/louislefevre/node-red-contrib-quantum/blob/43f8d2867c153243c23ab7a17950d38b86a96096/nodes/quantum/quantum-register/quantum-register.js#L48

https://github.com/louislefevre/node-red-contrib-quantum/blob/43f8d2867c153243c23ab7a17950d38b86a96096/nodes/quantum/classical-register/classical-register.js#L45

Steps to Reproduce Bug

Run a quantum flow and logs out the global state object

Expected Behaviour & Actual Behaviour

quantumCircuit object should be populated, but in reality the global state looks like this:

quantumCircuit: [ <3 empty items> ],
'quantumCircuit[0]': { registerType: 'quantum', registerName: 'r0', registerVar: 'qr0' },
'quantumCircuit[1]': { registerType: 'quantum', registerName: 'r1', registerVar: 'qr1' }
bbaayezi commented 3 years ago

fixed in PR #92