Skip to content

Why makeAutoObservable does not support subclassing #2850

Answered by urugator
cncolder asked this question in Q&A
Discussion options

You must be logged in to vote

The situation where the extended classes are abstract (can't be instantiated) - meaning you can call makeAutoObservable only once in the "subbest" class - is kinda supportable, the problem is if the extended class is eg React.Component - in such case makeAutoObservable should ignore all it's fields and prototype.
In other cases, you must be able to call makeAutoObservable multiple times on the same object - this is problematic, because we don't know which fields of the object were already annotated and which were not (this is mostly due to the ability to provide overrides option to makeAutoObservable or when you would combine it with makeObservable). It would also prevented some optimizat…

Replies: 3 comments 15 replies

Comment options

You must be logged in to vote
10 replies
@urugator
Comment options

@stephenh
Comment options

@Kashuab
Comment options

@inoyakaigor
Comment options

@inoyakaigor
Comment options

Answer selected by cncolder
Comment options

You must be logged in to vote
4 replies
@urugator
Comment options

@stephenh
Comment options

@LandonSchropp
Comment options

@urugator
Comment options

Comment options

You must be logged in to vote
1 reply
@urugator
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
8 participants