-
Notifications
You must be signed in to change notification settings - Fork 26
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
Give feedback on Blaze Components #80
Comments
Hi Mitar, First thank you for blaze-components! I used it for Wekan which is the kind of application that inherently requires a number of UI components to work together (with the ability to compose them) and Blaze didn’t have the long awaited API to handle that. I've been considering the switch to React (and I still do, see wekan/wekan#299) but React still misses a good integration with the Meteor ecosystem, and keeping the Blaze runtime was easier. So I decided to give Blaze-components a try. I've been pretty happy with that choice. Since you are asking for issues, here are the one I encountered:
Max |
The main reason to use it for me personally is the OOP approach of coding. It's what felt natural (and logical) to me. I don't use mixins at all though, although I appreciate what their goal and meaning are, I just didn't felt the need and rather went for an inheritance approach. Something that might become more clear once I start using BC's in more specific use cases, but for now what feels "fuzzy" is a right way for inter-component communication. I come from an Adobe Flex/AS3 world. Where a lot of these challenges have been fixed by relying on event dispatching a lot more. I know BC's support all this as well at it's core, but falls back to DOM events. Just like Blaze (I guess? Correct me if I'm wrong). So something that would allow for direct events/listeners on component level would feel comfortable for me (taking my background into account). A small (very small) "huh" moment I had, was why I need to register components after defining them. But that might just be js-related. Cheers! |
Thanks for the feedback! My thoughts:
That is so interesting to me that people have so much issues with this. I must say that I do not get it. :-) I think maybe the issue is that I have not made it clear enough what is the way to use that in Blaze Components, over Blaze, and people get stuck with Blaze issues? I really do not get the issue. :-) See my comment here for another take on answer this concern. The point with Blaze Components is that you should not be using This is also why there is no Maybe I should provide more functions and instructions for this. Is this addressing what you are talking? Or not? Why are props still better in your opinion? There is another way to communicate between components and this is to expose APIs between them (methods). And then call them. Hm, I am seeing that this assumes all those goodies for navigating the tree. Maybe I should really or put this into a package or add it to core Blaze Components. So imagine a jQuery selectors for selecting ancestor or descendant components.
With new build system this is something you could develop on top of Blaze Components, no? See meteor-sideburns (and my comment). So this could probably work in the other direction as well? I prefer separate files, but I think this can probably be doable? A package would be welcome. :-)
Why global storage? Why not component state? So I could imagine a component like: <template name="FormInput">
{{#if editing}}
<input type="text" value={{value}} />
{{else}}
<div>{{value}}</div>
{{/if}}
</template> And you switch between editing and non-editing mode, but keep the state of the value as a state of the component? I am trying to find actionable items, so have also in mind to suggest what concretely to open (tickets welcome). |
So something similar to examples from the tutorial? |
On the first point, I actually do use the For the second question, I put the drafts in the global storage and not in a local component state (as I was formerly) because often the component get destroyed and I still want to keep the data, for instance if I'm editing a card description and inexpediently close the card (or if I open another card B on purpose and still expected my draft on A to be there). Generally speaking I tend to think that component local storage aren’t a good idea, I think that a global storage tree from which each component only see its assigned branch is a more powerful concept because it allows things like serializing the whole state and restore the application in the exact same state, and other things. There are quite a few discussions about this idea in the Redux and Clojurescript communities. |
OK, I see I will have to discuss this a bit more in the README. :-) So no, I am pretty against the event-based communication because it is really hard to manage it as system grows. You have to then make sure about event propagation, stopping and so on. What I think is a better approach is that you traverse a tree of components and call methods on them.
You do not have to. You have only if you want them to be accessible from templates. So And yes, that is a bit of a JavaScript limitation. Open to suggestions, but I think this is the cleanest one. (BTW, if you do not register them, then you have to still name them by calling |
I explained a bit about ideas of inter-component communication here: #82 |
Isn't this what data context is then about? Giving data to a child? Not sure anymore what is then a problem. (Sorry, I would really like to understand the problem.)
Oh, I will ask if we can open source a mixin for this. :-) So we have this, a mixin which ads serializable state to each component, and then store them in a tree structure into the database. So even if you reload the page, you get back the same UI state. We use that for our in-site window manager made with Blaze Components. You do not want for user to reopen all windows all the time when things gets reloaded. I think you could use that as well. You can imagine even storing into it things like scrolling position, which cards are expanded, and also any form input state. So then you have local state which you do not want to store, and seriazable local state which is stored and populated for you automatically when component is created. BTW, this is a pretty short piece of code. :-) |
Not sure if this has been asked before, but, I'm wondering if it is somehow possible to pass E.g. currently I need to explicitly define the attributes in my component if I want those attributes to be rendered in the page:
In case of my The only option I currently have is to create a specialised subclass component that is Any ideas and insights much appreciated. |
@northern: I think this discussion should be more suited for a dedicated ticket. Please open it and copy the content there. |
Thanks for all the feedback. Closing the ticket for now. |
I am asking the community to give some feedback on how you are using Blaze Components. Examples of apps you build them? Patterns you like? But most importantly what are possible issues you are having? All that would help guide the future of the project.
The text was updated successfully, but these errors were encountered: