Open JulianKingman opened 8 years ago
Show the sample code
Fragment = Astro.Class({
name: 'Fragment',
collection: Fragments,
fields: {
//skipping irrelevant fields
source: {
type: 'array',
default: function(){return [];}
}
},
behaviors: {
timestamp: {},
sort: {
orderFieldName: 'sortOrder',
hasRootField: true,
rootFieldName: 'source'
}
}
//skipping irrelevent methods
}
And then the template event:
'click .nextFragment': function () {
Session.get('currentFragment').moveUp();
Session.set('currentFragment', Fragments.findOne({sortOrder: 0}));
}
note: also tried moveToBottom() and all the other sort methods, same error.
With template.onRendered, 'currentFragment' is set like this: Session.set('currentFragment', Fragments.findOne({sortOrder: 0}));
Hmm... I'm not specifying the source field in the Session variable, so it could be sorting the wrong list. Let me try that, let me know if you see any other issues, in the meantime.
You probably have deny rules on the Fragments collection that disallow such update
No deny rules in the whole app. Any other things that could cause that?
Log to the console what is inside Session.get('currentFragment')
and post here. It's hard to tell without investigation.
It looks like this:
{
"_modifiers": {},
"_references": {},
"_id": "ijZzJyf6WhHB3zxqu",
"createdAt": null,
"updatedAt": null,
"sortOrder": 0,
"source": [
"dH9an2iWmccgJ3csx"
],
"text": "Text fragment",
"dateSearched": null,
"dateStarted": null,
"depthSearched": 0,
"depthDescription": null,
"status": "Ready",
"searchedBy": null,
"locked": null,
"useSource": false,
"links": [],
"_isNew": false
}
Astronomy methods seem to work on it (like Session.get('currentFragment').raw())
You will have to create reproduction repository. It's probably not astronomy fault. I will take a look at reproduction when I'm back from vacations.
I get this error when using the sort methods. Do I need to set allow rules or run it in a method?