Skip to content

Accounting for if docs exist before calling 'dataByKey' #67

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

smohanty92
Copy link
Contributor

No description provided.

@jdalrymple
Copy link

I tested this out, but got hit with another exception: "Cannot read property 'dataByKey' of undefined"

@smohanty92
Copy link
Contributor Author

@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.

@vbgm
Copy link
Contributor

vbgm commented Feb 5, 2024

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
robfallows previously approved these changes Feb 5, 2024
Copy link
Owner

@robfallows robfallows left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Apologies for inadvertently approving. The required version has advanced considerably and should now be 1.3.13

@robfallows robfallows dismissed their stale review February 5, 2024 13:38

Version number is back-level. Should be 1.3.13

@vbgm
Copy link
Contributor

vbgm commented Feb 5, 2024

@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! :-)

@vbgm
Copy link
Contributor

vbgm commented Feb 5, 2024

@robfallows Here it is: #79
So that I get rid of my customised version of this wonderful package :-)

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

Successfully merging this pull request may close these issues.

4 participants