-
Notifications
You must be signed in to change notification settings - Fork 17
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
Add Comment component #42
base: master
Are you sure you want to change the base?
Conversation
I agree with your arguments. I'm not suggesting that we don't support comment component at all. I think we might want to handle unsupported components similarly ie. have them in the component tree but be inert in the rendering. So that you can still use (from the editor for e.g.) the component tree manipulation methods So what i suggest is this:
|
That makes perfect sense.This way seems the best. Should I do it, or will you? I'm not 100% sure how to do the |
If you're up for it. You can just continue adding to this PR, you already have most of it. Happy to help if you have any questions. |
63cdc3f
to
ccbc93e
Compare
I tried to write a unit test for either |
Ah I screwed up again. I'll just not have |
ccbc93e
to
efaf503
Compare
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.
Please feel free to commit WIP tests if you'd like me to take a look at them. Thanks!
@@ -49,6 +50,10 @@ export default abstract class Container extends Component implements IContainer | |||
continue; | |||
} | |||
const component = new componentClass(this.main, this, opts); | |||
if (component instanceof Inert) { |
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.
Sorry If I wasn't clear about this in my previous comment. We'll never have an Inert
component in the preset so this if block will never run. What we really want to do here is to implicitly create Inert
component when componentClass
cannot be found in the registry. So we can just replace the continue;
in the previous if block with something like componentClass = Inert;
.
super(main, parent, opts); | ||
} | ||
|
||
public updateText() { |
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.
We don't really need this update handler or the text
private property. The private text
property is not used anywhere inside this class and it's not exposed to anyone so it has no purpose. The text
option is however already maintained in the opts
property. When Webvs clients update them with the set
method on a component it is automatically updated.
The update handlers are a way for the component to react to changes in opts and update internal state, re-compile shaders etc.
See previous discussion on #41.
(Branch typo fixed, hence new PR)