meteor-pg icon indicating copy to clipboard operation
meteor-pg copied to clipboard

PgSubscription failed in reactive code

Open IcyEagle opened this issue 7 years ago • 0 comments

There is a problem with subscription within a reactive container (React framework used).

const MyComponentContainer = createContainer(() => { const sub = new PgSubscription('my_sub'); return {ready: sub.ready()}; }, MyComponent);

Stacktrace: Error: Subscription failed! at new PgSubscription (numtel_pg.js?hash=fd09c3fa16444bc31c10791b57c23cdf3a72123d:80) at TradingScreen.js:30 at Object.getMeteorData (createContainer.jsx:33) at ReactMeteorData.jsx:89 at Tracker.Computation._compute (tracker.js?hash=9f8a0cec09c662aad5a5e224447b2d4e88d011ef:339) at new Tracker.Computation (tracker.js?hash=9f8a0cec09c662aad5a5e224447b2d4e88d011ef:229) at Object.Tracker.autorun (tracker.js?hash=9f8a0cec09c662aad5a5e224447b2d4e88d011ef:604) at ReactMeteorData.jsx:76 at Object.Tracker.nonreactive (tracker.js?hash=9f8a0cec09c662aad5a5e224447b2d4e88d011ef:631) at MeteorDataManager.calculateData (ReactMeteorData.jsx:75)

I investigated the issue. Implementation raises an exception when subscription with the same name/parameters already exist (since a new sub hasn't been created). Probably it's necessary to check active subscriptions to obtain ID.

IcyEagle avatar Oct 11 '17 09:10 IcyEagle