Skip to content
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

Subscription reactivity issue for many type links #481

Closed
gabrielcazacu96 opened this issue Jan 26, 2024 · 4 comments
Closed

Subscription reactivity issue for many type links #481

gabrielcazacu96 opened this issue Jan 26, 2024 · 4 comments

Comments

@gabrielcazacu96
Copy link

Issue

Subscription query result does not get updated when a new link is added.

Example

  1. Initial data
Groups:
[{ _id: 'groupId1'}, {_id: 'groupId2'}]
Authors:
[{_id: 'authorId1', groupIds: ['groupdId1']}, {_id: 'authorId2', groupIds: ['groupdId2']}]
  1. Query
const query = createQuery({
    groups: {
        authors: {
            groupIds: 1,
        }
    }
});
  1. If I add groupId1 to the groupIds of authorId2, the query result does not update.
  2. Expected subscription query result
[{ 
_id: 'groupId1',
authors: [{_id: 'authorId1', groupIds: ['groupdId1']}, {_id: 'authorId2', groupIds: ['groupdId1', 'groupdId2']}]
},
{
_id: 'groupId2',
authors: [{_id: 'authorId2', groupIds: ['groupdId2']}]
}]
  1. Actual subscription query result never changes
[{ 
_id: 'groupId1',
authors: [{_id: 'authorId1', groupIds: ['groupdId1']}]
},
{
_id: 'groupId2',
authors: [{_id: 'authorId2', groupIds: ['groupdId2']}]
}]

Additional info

  • This seems to happen only for many type links
  • Issue seems to be related to the meteor-publish-composite package and how the cursor events are triggered.
  • Issue happens only if the linked object is already linked to another parent object in the query. In the example, the author is already linked to another group.
@gabrielcazacu96
Copy link
Author

Added demonstration test: #482
Only works the first time because after that, the mongodb data is changed.

@gabrielcazacu96
Copy link
Author

Added fix attempt to meteor-publish-composite: Meteor-Community-Packages/meteor-publish-composite#177

@StorytellerCZ StorytellerCZ linked a pull request Feb 28, 2024 that will close this issue
@gabrielcazacu96
Copy link
Author

Thanks to #179 this should no longer be an issue once meteor-publish-composite is updated to version v1.8.8

@StorytellerCZ
Copy link
Collaborator

@gabrielcazacu96 per your comment this should be fixed in v1.5

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 a pull request may close this issue.

2 participants