Skip to content
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

Conflict with closure_tree #189

Closed
ryanb opened this issue Apr 21, 2020 · 9 comments
Closed

Conflict with closure_tree #189

ryanb opened this issue Apr 21, 2020 · 9 comments
Labels

Comments

@ryanb
Copy link

ryanb commented Apr 21, 2020

I'm seeing this in our development log:

WALLABY DEBUG: Reloading after Rails' reload...
/Users/rbates/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/closure_tree-7.1.0/lib/closure_tree/support.rb:36: warning: already initialized constant ObjectiveHierarchy
/Users/rbates/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/closure_tree-7.1.0/lib/closure_tree/support.rb:36: warning: previous definition of ObjectiveHierarchy was here
/Users/rbates/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/closure_tree-7.1.0/lib/closure_tree/support.rb:36: warning: already initialized constant OrgNodeHierarchy
/Users/rbates/.rbenv/versions/2.5.5/lib/ruby/gems/2.5.0/gems/closure_tree-7.1.0/lib/closure_tree/support.rb:36: warning: previous definition of OrgNodeHierarchy was here

It appears Wallaby is loading these classes which closure_tree doesn't expect. I tried adding the classes to Wallaby's exclude config but I still see these warnings. Can you make it so excluding models makes it so Wallaby doesn't attempt to require them?

@tian-im
Copy link
Collaborator

tian-im commented Apr 22, 2020

Let me double-check if any Class is still stored in Wallaby::Map. Is this issue for envisage?

@ryanb
Copy link
Author

ryanb commented Apr 22, 2020

Yeah, this is for Envisage. The develop branch.

@ryanb
Copy link
Author

ryanb commented Apr 22, 2020

Does wallaby attempt to load classes based on database tables? This may be the issue if so.

@tian-im
Copy link
Collaborator

tian-im commented Apr 22, 2020

Nope, Wallaby only loads the files under eager_load_paths which is the /app folder, it doesn't read the database tables.

Sure, I will take a look.

@tian-im
Copy link
Collaborator

tian-im commented Apr 23, 2020

@ryanb I can confirm that this is an issue of closure_tree, not wallaby.

I've tried to taken wallaby out completely from the Gemfile, config/routes.rb, config/initializers/wallaby.rb, and if I made any changes to Objective model and visited GET "/objectives", when Rails reloaded, this warning came up. And if you take a look into the list of constants that Rails maintains by using:

ActiveSupport::Dependencies.autoloaded_constants

You will see that Objective is in the list, but the ObjectiveHierarchy created by closure_tree is not captured by Rails Dependencies. Therefore, on every reload, ObjectiveHierarchy will not be removed by Rails before it gets recreated.

@ryanb
Copy link
Author

ryanb commented Apr 24, 2020

@tian-im oops, sorry about that. I tried removing wallaby as well and was not able to duplicate the warning. I'll close this ticket.

Thanks for taking the time to look into this.

@ryanb ryanb closed this as completed Apr 24, 2020
@tian-im
Copy link
Collaborator

tian-im commented Apr 24, 2020

No worries :)

@ryanb
Copy link
Author

ryanb commented Apr 27, 2020

FYI, I posted an issue here on closure_tree: ClosureTree/closure_tree#362

@tian-im
Copy link
Collaborator

tian-im commented Apr 27, 2020

👌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants