netzke / netzke-core

Framework for Sencha Ext JS + Ruby on Rails client-server components
http://netzke.org
Other
263 stars 77 forks source link

Couldn't load component cmp1 error when dynamically loading tab in workspace #76

Closed rvwong closed 10 years ago

rvwong commented 10 years ago

Environment: Ruby 2.0 Rails 4.0 netzke-core 0.90 netzke-base 0.9.0 netzke-communitypack 0.80 When trying to load a component into a tab using the netzke Workspace, I get the error "Couldn't load component cmp1" error. I tracked the error to the Netzke::Core::Composition module, specifically the deliver_component endpoint. In this method, the line of code;

'''cmp_instance = components[component_name] && !components[component_name][:excluded] && component_instance(component_name, {item_id: item_id, client_config: params[:client_config]})'''

cmp_instance should be returning a component line "UserGrid" which would be inserted into the tab, it is returning nil instead when it shouldn't. I traced the problem further to the function call 'component_instance' that is called in that expression. I'm by no means completely familiar with Netzke code, but this where my understanding of the code is sparse. I noted that Max had made significant changes to the code for the component_instance method, as a matter of fact the code was completely replaced from the older working version. The new code seems to expect that any child components should have a method 'child component name'_component present in the parent component's code. I looked every where and cannot find where this method is dynamically inserted prior to this component_instance method being called, as a result 'component_instance' will always return nil. Just verify my theory, I monkey patched in the old code that was there before the code change, and low and behold components correctly get inserted into Workspace tabs. Can you please look into this Max? Thanks for creating Netzke btw, big fan!

mxgrn commented 10 years ago

Y'day I got to extracting Workspace to a dedicated gem, making it compatible with latest Core. Plan to publish it within the next 2-4 days.

rvwong commented 10 years ago

Ok Max, thank you for addressing this so quickly! You da man!

mxgrn commented 10 years ago

Sorry it took me so long eventually, but here it is: https://github.com/netzke/netzke-workspace

It's just been released as a gem, too.

Please, let me know whether you have any troubles using it.