scorpiusjs / scorpius

Modular admin solution built with Meteor
http://scorpiusjs.org
MIT License
34 stars 7 forks source link

Small bug in the Materialize layout? #65

Open daveyshindig opened 7 years ago

daveyshindig commented 7 years ago

Hello,

I am having a little trouble with the admin panel's collapsible/sideNav functions in Firefox. Not sure if or how that's related, but at the top of the browser console stack trace there's an error in a template helper, and I think I see the bug.

The line of code is const userProfile = Meteor.users.findOne(Meteor.userId).profile

I believe it needs to be something like const userProfile = Meteor.users.findOne(_id: Meteor.userId()).profile

Here's where you can find it: https://github.com/scorpiusjs/scorpius/blob/6463fb179c43cdaab40506397b2a9c6a37327754/packages/materialize/views/layout/layout.js#L17

The full stack trace I'm getting in FF is

Exception in template helper: userPicture@http://localhost:3000/packages/scorpiusjs_materialize.js?hash=3b94d12135c285f2f7c0d1422ead857d1261324c:368:7
bindDataContext/<@http://localhost:3000/packages/peerlibrary_blaze-components.js?hash=6f74153f76e6d77dfd2f88fc0b4da655d2f0f1af:1403:14
Blaze._wrapCatchingExceptions/<@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:1715:14
wrapHelper/</<@http://localhost:3000/packages/peerlibrary_blaze-components.js?hash=6f74153f76e6d77dfd2f88fc0b4da655d2f0f1af:1424:14
Template._withTemplateInstanceFunc@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:3744:12
wrapHelper/<@http://localhost:3000/packages/peerlibrary_blaze-components.js?hash=6f74153f76e6d77dfd2f88fc0b4da655d2f0f1af:1423:12
Spacebars.call@http://localhost:3000/packages/spacebars.js?hash=ebf9381e7fc625d41acb0df14995b7614360858a:172:12
Spacebars.mustacheImpl@http://localhost:3000/packages/spacebars.js?hash=ebf9381e7fc625d41acb0df14995b7614360858a:106:10
Spacebars.mustache@http://localhost:3000/packages/spacebars.js?hash=ebf9381e7fc625d41acb0df14995b7614360858a:110:16
src@http://localhost:3000/packages/scorpiusjs_materialize.js?hash=3b94d12135c285f2f7c0d1422ead857d1261324c:273:16
Blaze._withCurrentView@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:2271:12
visitAttribute@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:2199:15
visitAttributes@http://localhost:3000/packages/htmljs.js?hash=1ac878018eee6c53ed1375dc7ee75fc6865666ae:223:24
visitAttributes@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:2193:12
Blaze._expandAttributes@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:2221:11
Blaze._expandAttributes@http://localhost:3000/packages/peerlibrary_blaze-components.js?hash=6f74153f76e6d77dfd2f88fc0b4da655d2f0f1af:2947:12
updateAttributes@http://localhost:3000/packages/peerlibrary_blaze-components.js?hash=6f74153f76e6d77dfd2f88fc0b4da655d2f0f1af:1022:27
viewAutorun/</<@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:1934:18
Template._withTemplateInstanceFunc@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:3744:12
viewAutorun/<@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:1932:14
Blaze._withCurrentView@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:2271:12
viewAutorun@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:1931:12
Tracker.Computation.prototype._compute@http://localhost:3000/packages/tracker.js?hash=997515fa2d5b0530ba07741da556c4b36963ef3b:339:5
Tracker.Computation@http://localhost:3000/packages/tracker.js?hash=997515fa2d5b0530ba07741da556c4b36963ef3b:229:5
Tracker.autorun@http://localhost:3000/packages/tracker.js?hash=997515fa2d5b0530ba07741da556c4b36963ef3b:613:11
Blaze.View.prototype.autorun@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:1944:14
materializeTag@http://localhost:3000/packages/peerlibrary_blaze-components.js?hash=6f74153f76e6d77dfd2f88fc0b4da655d2f0f1af:1035:9
materializeDOMInner@http://localhost:3000/packages/peerlibrary_blaze-components.js?hash=6f74153f76e6d77dfd2f88fc0b4da655d2f0f1af:950:24
Blaze._materializeDOM@http://localhost:3000/packages/peerlibrary_blaze-components.js?hash=6f74153f76e6d77dfd2f88fc0b4da655d2f0f1af:920:3
Blaze._materializeDOM@http://localhost:3000/packages/peerlibrary_blaze-components.js?hash=6f74153f76e6d77dfd2f88fc0b4da655d2f0f1af:929:7
doMaterialize@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:2092:32
Tracker.nonreactive@http://localhost:3000/packages/tracker.js?hash=997515fa2d5b0530ba07741da556c4b36963ef3b:640:12
doRender@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:2090:9
viewAutorun/</<@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:1934:18
Template._withTemplateInstanceFunc@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:3744:12
viewAutorun/<@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:1932:14
Blaze._withCurrentView@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:2271:12
viewAutorun@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:1931:12
Tracker.Computation.prototype._compute@http://localhost:3000/packages/tracker.js?hash=997515fa2d5b0530ba07741da556c4b36963ef3b:339:5
Tracker.Computation.prototype._recompute@http://localhost:3000/packages/tracker.js?hash=997515fa2d5b0530ba07741da556c4b36963ef3b:358:9
Tracker._runFlush@http://localhost:3000/packages/tracker.js?hash=997515fa2d5b0530ba07741da556c4b36963ef3b:532:9
onGlobalMessage@http://localhost:3000/packages/meteor.js?hash=27829e936d09beae3149ecfbf3332c42ccb1596f:401:11
  meteor.js:930:11
Exception from Tracker afterFlush function:  meteor.js:930:11
TypeError: this.$(...).collapsible is not a function  meteor.js:930:11
sidebar.js/<@http://localhost:3000/packages/scorpiusjs_materialize.js?hash=3b94d12135c285f2f7c0d1422ead857d1261324c:489:2
fireCallbacks/<@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:3398:9
Template._withTemplateInstanceFunc@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:3744:12
fireCallbacks@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:3394:3
Template.prototype.constructView/<@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:3487:5
fire/</<@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:1845:11
Blaze._withCurrentView@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:2271:12
fire/<@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:1844:9
Tracker._runFlush@http://localhost:3000/packages/tracker.js?hash=997515fa2d5b0530ba07741da556c4b36963ef3b:548:11
onGlobalMessage@http://localhost:3000/packages/meteor.js?hash=27829e936d09beae3149ecfbf3332c42ccb1596f:401:11
  meteor.js:930:11
Exception from Tracker afterFlush function:  meteor.js:930:11
TypeError: this.$(...).sideNav is not a function  meteor.js:930:11
layout.js/<@http://localhost:3000/packages/scorpiusjs_materialize.js?hash=3b94d12135c285f2f7c0d1422ead857d1261324c:354:2
fireCallbacks/<@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:3398:9
Template._withTemplateInstanceFunc@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:3744:12
fireCallbacks@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:3394:3
Template.prototype.constructView/<@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:3487:5
fire/</<@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:1845:11
Blaze._withCurrentView@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:2271:12
fire/<@http://localhost:3000/packages/blaze.js?hash=f33d3dfed63a491d24e3aa07ad66c24b5fe8c761:1844:9
Tracker._runFlush@http://localhost:3000/packages/tracker.js?hash=997515fa2d5b0530ba07741da556c4b36963ef3b:548:11
onGlobalMessage@http://localhost:3000/packages/meteor.js?hash=27829e936d09beae3149ecfbf3332c42ccb1596f:401:11
  meteor.js:930:11
Velocity is already loaded. You may be needlessly importing Velocity again; note that Materialize includes Velocity.  materialize.min.js:6:3571

The side navigation menu refuses to open or close in Firefox (though it's open by default at narrow viewport widths). Chrome doesn't have this problem.

In any case, I hope this is helpful. Thanks for all the hard work you've put in to this package!

rwatts3 commented 7 years ago

Thank you for sharing this, would you be willing to provide a pull request and test it in IE, and Chrome as well. I'll be happy to merge if the tests pass, and the solution fixes the issue.