New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Restore constructor props commits #4716
Conversation
This is probably why: var test = { a: 1, b: 2, c: 3 };
Object.assign(test, { b: undefined, c: null });
//test = {a: 1, b: undefined, c: null} |
this.unread = 0; | ||
this.highlight = 0; | ||
this.users = new Map(); | ||
this.muted = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is a class now, why don't we assign all of these as defaults on the class properties instead of setting them in the constructors?
this.muted = false; | ||
|
||
if (attr) { | ||
Object.assign(this, attr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a better fix would be make all of the parameters that chan creation uses explicit parameters of the constructor, such as constructor(name, type, key, muted)
(and whatever else parameters can be set on creation.
Alternatively, it could be static helpers such as createNewQuery
which returns an instance of new Chan
that is set to type of query.
these comment also applies to the other models
Let's go with the approach outlined by xpaw there and avoid similar issues for now if we can, or at least log them. |
Val's PR apparently fixes the issue introduced by e31c95e in #4710
Meaning we can re-introduce the commits that were reverted after merging it.
However, I don't understand why the commit referenced above exposes the breakage that was apparently already there in the first place.
I'd appreciate it if someone could educate me / point my brain in the right direction