Open zimme opened 9 years ago
same here!
I think it's re-rendering a template instance and overwriting the data context set up in Template.created. But in all my testing it seemed to persist across reactive re-renderings. Could one of you share your routing setup so I can try to reproduce this?
my routing setup is very simple:
Router.configure({ loadingTemplate: 'loading', notFoundTemplate: 'notfound', layoutTemplate: 'main' });
Router.map(function () {
this.route('master', {
path: '/',
layoutTemplate: 'main',
yieldTemplates: {
'SidebarContents': {
to: 'sidebarContents'
},
}
});
this.route('frameworks', { path: '/frameworks', layoutTemplate: 'main', yieldTemplates: { 'frameworksSidebarContents': { to: 'sidebarContents' }, } });
this.route('framework_detailed', { path: /^\/framework\/(\d+)-(\d+)-(\d+)-(\d+)-(\d+)-(\d+)/, layoutTemplate: "framework_detailed" });
this.route('log', {
path: /^\/log\/(\d+)/,
layoutTemplate: "log"
});
});
I'm having the problem when I go from /framework to /framework-20141007-200657-251789322-5050-14183-0000
Thanks! Is the data in your table based on the numbers in the path?
Please try out 0.5.1 and let me know if it fixes the error. I'm not that happy with the change but I think it works... hard to reproduce this consistently though :)
Working for me. When I have some time I'll try and help out with making a "cleaner" version of the change =)
I had this same error, and 0.5.1 has fixed it for me, thanks.
it works in 0.5.2 but in 0.5.3 its broken again
Sorry about that. It should be fixed in 0.5.4.
wow, that was fast :+1: many thanks!!!!
Still getting this error on 0.5.4
Sorry, there are a couple separate bugs here.. try 0.5.5, fingers crossed :)
Still have it with 0.5.5. Looks like a stubborn one :)
Are you getting the same stack trace as above, or only the isVisible part?
Only the isVisible part.
Exception in template helper: TypeError: Cannot read property 'get' of undefined
at Object.Template.reactiveTable.helpers.isVisible (http://localhost:3000/packages/aslagle_reactive-table.js?f8086358ed785564ac05094c0ae1cf68ac660677:805:39)
at http://localhost:3000/packages/blaze.js?77c0809654ee3a10dcd5a4f961fb1437e7957d33:2693:16
at http://localhost:3000/packages/blaze.js?77c0809654ee3a10dcd5a4f961fb1437e7957d33:1602:16
at Object.Spacebars.call (http://localhost:3000/packages/spacebars.js?3c496d2950151d744a8574297b46d2763a123bdf:169:18)
at http://localhost:3000/packages/aslagle_reactive-table.js?f8086358ed785564ac05094c0ae1cf68ac660677:99:24
at null.
And which part of the table isn't working? Are the rows showing?
Don't see any side effects (besides making the page look like it has errors in IE). Everything seems to be working.
That's strange. Maybe it's initially missing the settings, and then re-renders.
I'm getting the same error message as @sys13, I'm using V. 0.5.5
FWIW, I had this same error on 0.5.0. Upgrading to 0.5.5 fixed it for me (I wasn't using it on two different routes though).
I'm having the same issue on 0.5.5 on one view.
Exception in template helper: TypeError: Cannot read property 'get' of undefined
at Object.Template.reactiveTable.helpers.isVisible (http://localhost:3000/packages/aslagle_reactive-table.js?cab9a5ad9912f7775039087d2b4f2a80c12d8364:805:39)
at http://localhost:3000/packages/blaze.js?77c0809654ee3a10dcd5a4f961fb1437e7957d33:2693:16
at http://localhost:3000/packages/blaze.js?77c0809654ee3a10dcd5a4f961fb1437e7957d33:1602:16
at Object.Spacebars.call (http://localhost:3000/packages/spacebars.js?3c496d2950151d744a8574297b46d2763a123bdf:169:18)
at HTML.LI.HTML.A.HTML.LABEL.Blaze.If.HTML.INPUT.type (http://localhost:3000/packages/aslagle_reactive-table.js?cab9a5ad9912f7775039087d2b4f2a80c12d8364:205:26)
at null.
It seems this happens now when you try and render a table with an empty collection. i.e. parentData(1) or parentData(2) don't exists.
Those of you seeing this in 0.5.5, does anyone have a public repo or app I could take a look at?
FWIW, I'm using v. 0.5.6, I'm using several instances of this templates and so far I get this error only in one of those interfaces in one specific case. I click on a row. I also have some code for the click event in "tbody tr". First time I click on a row it works perfect, as expected, the second time that I click in any row I got this error (at least 22 times at once).
Exception in template helper: TypeError: Cannot read property 'get' of undefined
at Object.Template.reactiveTable.helpers.isVisible (http://localhost:3000/packages/aslagle_reactive-table.js?ea00290ae77ff9c2d8eb60e2296b471da2b7e490:810:39)
at http://localhost:3000/packages/blaze.js?77c0809654ee3a10dcd5a4f961fb1437e7957d33:2693:16
at http://localhost:3000/packages/blaze.js?77c0809654ee3a10dcd5a4f961fb1437e7957d33:1602:16
at Object.Spacebars.call (http://localhost:3000/packages/spacebars.js?3c496d2950151d744a8574297b46d2763a123bdf:169:18)
at HTML.LI.HTML.A.HTML.LABEL.Blaze.If.HTML.INPUT.type (http://localhost:3000/packages/aslagle_reactive-table.js?ea00290ae77ff9c2d8eb60e2296b471da2b7e490:205:26)
at null.
So I followed the link http://localhost:3000/packages/aslagle_reactive-table.js?ea00290ae77ff9c2d8eb60e2296b471da2b7e490:810:39
and I think for some reason topLevelData
is either undefined or has the wrong object. I hope this helps you at least a little
An error still can be reproduced on 0.5.8 release.
For me an error occurs only in case topLevelData
gets Template.parentData(1);
value which in this case isn't a reactiveTableSetup
. It seems to be an object of params that are passed to reactiveTable template. For example I have {{> reactiveTable collection=matchedContacts settings=settings }}
and topLevelData
becomes {collection: Array[1], settings: Object}
.
When I define visibleFields
property manually and pass it to reactiveTable template alongside with other params it gets used in this case.
That confirms that setup
isn't running before isVisible
gets called. You shouldn't need to pass in visibleFields
- it will be replaced if setup
runs.
If you want to fix it, you could try having isVisible
return false if both Template.parentData(2)
and Template.parentData(1)
don't have reactiveTableSetup
. It would give you a table with no columns, but maybe setup
would run afterward and the table would re-render. You could also try calling setup
from more places. I still can't reproduce this so I won't be able to tell if it works.
setup
function indeed runs after isVisible
helper is accessed.
An error flow is as follows:
rendered
event runs setup
isVisible
helper runs without any errorsisVisible
helper is fired again and an error occurssetup
get's fired from setup helperIt looks like helpers not necessarily run one after another as defined in a template.
After #4, does isVisible
run again? That would probably make it easier to fix.
@aslagle yes isVisible
runs again after setup on the fourth stage.
Ok, I published version 0.5.10-alpha1 which might fix this, but it also might give you an empty table instead. Try it out and let me know if it helps. It's a pre-release so I think you'll have to manually set the version.
0.5.10-alpha1 renders only an empty table for me.
On Wed, Dec 17, 2014 at 7:54 AM, Amy Slagle notifications@github.com wrote:
Ok, I published version 0.5.10-alpha1 which might fix this, but it also might give you an empty table instead. Try it out and let me know if it helps. It's a pre-release so I think you'll have to manually set the version.
— Reply to this email directly or view it on GitHub https://github.com/ecohealthalliance/reactive-table/issues/116#issuecomment-67324698 .
Seems to work fine for me.
Hmm.. maybe there's still more than one bug. I have another idea but it'll be harder to implement.
In 0.5.10, I've switched back to a with statement and set up a separate template instance variable instead of template.data. I think it will fix at least one cause of this error :)
Indeed error doesn't come up on 0.5.10 for me.
0.5.10 has completely fixed the error for me. Good detective work @aslagle, thank you!
When using reactive table in 2 different routes when switching from one to the other i get this stack trace