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
Issue
When clicking on "Multiplayer" tab, I receive this error:
Impact
Users can't open the custom battle list browser. Also: letting this error sit with the electron app open will cause a massive slowdown as it eats up all the computers memory :(
Investigation
Looking at this code:
When debugged: props.battle.contenders is actually ComputedRefImpl object. To access the value, it should be "props.battle.contenders.value".
So the code is recognizing the battle as a Replay when it actually should recognized as an AbstractBattle and enter the if block where the ComputedRefImpl objects are handled appropriately.
So why is the battle being treated as a replay and not a battle?
tldr: instanceof checks that the object has the constructor for the given class.
So that means that an object must be instantiated using the constructor of the class [or subclass] to be recognized by instanceof.
Looking at custom.vue in scoreBattle function:
So while typescript recognizes this as a scoredSpadsBattle: instanceof will not because the object wasn't created used the constructor of a subclass of AbstractBattle.
Solution
Fold the scored battles data into the SpadsBattle class. Have the custom.vue component interact with the scored battles data that is stored within the SpadsBattle.
The text was updated successfully, but these errors were encountered:
Issue
When clicking on "Multiplayer" tab, I receive this error:
Impact
Users can't open the custom battle list browser. Also: letting this error sit with the electron app open will cause a massive slowdown as it eats up all the computers memory :(
Investigation
Looking at this code:
When debugged: props.battle.contenders is actually ComputedRefImpl object. To access the value, it should be "props.battle.contenders.value".
So the code is recognizing the battle as a Replay when it actually should recognized as an AbstractBattle and enter the if block where the ComputedRefImpl objects are handled appropriately.
So why is the battle being treated as a replay and not a battle?
Looking in
type-checkers.ts
:So we only recognize a battle as an abstract battle if
instanceof
abstract battle. Explanation ofinstanceof
from stackoverflow: https://stackoverflow.com/questions/2449254/what-is-the-instanceof-operator-in-javascripttldr:
instanceof
checks that the object has the constructor for the given class.So that means that an object must be instantiated using the constructor of the class [or subclass] to be recognized by
instanceof
.Looking at
custom.vue
inscoreBattle
function:So while typescript recognizes this as a
scoredSpadsBattle
:instanceof
will not because the object wasn't created used the constructor of a subclass ofAbstractBattle
.Solution
Fold the scored battles data into the
SpadsBattle
class. Have thecustom.vue
component interact with the scored battles data that is stored within theSpadsBattle
.The text was updated successfully, but these errors were encountered: