You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What is this feature about?
I manage the module node-red-contrib-gamedig for using GameDig with Node-RED. I noticed on the latest version of my module responses are not being passed through Node-RED correctly.
More specifically it looks like because GameDig now returns Results, Players, and Player objects it causes Node-RED to throw an error because NR doesn't know about these classes.
TypeError: Class constructor Players cannot be invoked without 'new'
This is because Node-RED takes data you are sending to nodes further down the chain and duplicates the data to prevent multiple flows from changing the same reference. When it tries to replicate this object it fails.
Because of this I now have to convert these classes to their Object / Array counterparts before sending it along. Example:
It would be nice if GameDig had a built in way to supply the state object using standard Array / Object classes instead of the Results, Players, and Player objects it currently uses. A flag that could be set or a function directly on GameDig would both seem like good solution to this.
Also I noticed the README.md page states that the players and bots fields in the query response is an array of objects when in reality it's a Players object that extends an array that contains Player objects.
Additional context/references
There may be an easier way to fix this. I tried using Object.assign({}, state); and it gives me an error as well.
The text was updated successfully, but these errors were encountered:
What is this feature about?
I manage the module node-red-contrib-gamedig for using GameDig with Node-RED. I noticed on the latest version of my module responses are not being passed through Node-RED correctly.
More specifically it looks like because GameDig now returns Results, Players, and Player objects it causes Node-RED to throw an error because NR doesn't know about these classes.
This is because Node-RED takes data you are sending to nodes further down the chain and duplicates the data to prevent multiple flows from changing the same reference. When it tries to replicate this object it fails.
Because of this I now have to convert these classes to their Object / Array counterparts before sending it along. Example:
It would be nice if GameDig had a built in way to supply the
state
object using standard Array / Object classes instead of the Results, Players, and Player objects it currently uses. A flag that could be set or a function directly on GameDig would both seem like good solution to this.Also I noticed the README.md page states that the
players
andbots
fields in the query response is anarray of objects
when in reality it's a Players object that extends an array that contains Player objects.Additional context/references
There may be an easier way to fix this. I tried using
Object.assign({}, state);
and it gives me an error as well.The text was updated successfully, but these errors were encountered: