Preserve prototypes in the synchronization logic #531
Labels
BP2022HG1 - Low Priority
BP2022HG1 - Needs Discussion or Decisions
Legacy
Issues that were created by the 2021 BP
Preserving the prototypes is the big design decision between only saving state in the
ExerciseState
(current implementation) or also behavior (functional vs. object-oriented programming).What would need to be done to achieve this?
class-transformer
could instantiate the state and all actions after the frontend & backend receive them over the network/from the database, ...const copy = { ...myObject }
withconst copy = clone(myObject)
..create()
or object literals, we would always have to use the constructor. (in theory, we could also somehow disable the error from immerJs to not rely on the.create()
functions).Positives
instanceof
instead of a discriminated union. There is no easy way to differentiate between elements #530.create()
to strip the prototype from the classNegatives
class-transformer
from How JavaScript Works (2018)
The text was updated successfully, but these errors were encountered: