tunguska-reactive-aggregate
tunguska-reactive-aggregate copied to clipboard
Accounting for if docs exist before calling 'dataByKey'
I tested this out, but got hit with another exception: "Cannot read property 'dataByKey' of undefined"
@jdalrymple Thanks for testing! Any chance you can share the code you're using so that I can reproduce and be able to debug more.
Having the same issue in a complex setup with NO_MERGE publications strategy and publishing to client-only collection.
Exception in changedobserveChanges callback: [
Cannot read property 'documents' of undefined
packages/tunguska:reactive-aggregate/aggregate.js 282:13
packages/tunguska:reactive-aggregate/aggregate.js 301:7
packages/tunguska:reactive-aggregate/aggregate.js 323:9
packages/meteor.js 1417:24
packages/meteor.js 1430:14
packages/mongo/observe_multiplex.js 178:30
packages/underscore.js 139:11
packages/mongo/observe_multiplex.js 172:9
packages/meteor.js 994:16
packages/meteor.js 971:12
] {
path: '',
sanitizedError: [
tunguska:reactive-aggregate [Error]
packages/tunguska:reactive-aggregate/aggregate.js 11:27
packages/meteor.js 692:17
packages/tunguska:reactive-aggregate/aggregate.js 282:13
packages/tunguska:reactive-aggregate/aggregate.js 301:7
packages/tunguska:reactive-aggregate/aggregate.js 323:9
packages/meteor.js 1417:24
packages/meteor.js 1430:14
packages/mongo/observe_multiplex.js 178:30
packages/underscore.js 139:11
packages/mongo/observe_multiplex.js 172:9
packages/meteor.js 994:16
packages/meteor.js 971:12
] {
isClientSafe: true,
error: 'Error',
reason: 'tunguska:reactive-aggregate',
details: undefined,
message: 'tunguska:reactive-aggregate [Error]',
errorType: 'Meteor.Error'
},
errorType: 'tunguska:reactive-aggregate'
}
It is almost solved by this PR, BUT need also to add question mark after get(localOptions.clientCollection)
:
const previousDocs = sub._session.collectionViews.get(localOptions.clientCollection)?.documents;
const previousFields = [previousDocs && previousDocs.get(doc_id).dataByKey.keys()];
@robfallows can't you just add the two lines of code yourself? :-) it will be faster than making this PR stuff OR waiting for @smohanty92 to react. Come on, efficiency over processes! :-)
@robfallows Here it is: https://github.com/robfallows/tunguska-reactive-aggregate/pull/79 So that I get rid of my customised version of this wonderful package :-)