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

Issue with filters when opening multiple tabs to trigger the same query? #477

Open
SpyridonZ opened this issue Apr 11, 2023 · 0 comments
Open

Comments

@SpyridonZ
Copy link

I've noticed odd behavior that seems to be affecting all of my queries, but it only seems to be occurring when I open multiple tabs, also using Vue in my app.

The only complexity at all in my queries is I use "embody" to add the users organizationId to the query. Example:

`embody(body, params) {

    body.$filters = body.$filters || {}; 

    // append org + any other filters
    const userOrg = OrganizationUsersCollection.findOne({ userId: params.userId });
    Object.assign(body.$filters, {
        _id: params.id,
        organizationId: userOrg.organizationId
    });

}`

It's functioning completely normally if I only have a single tab open, even if I navigate quickly between "View Product" pages which use this query.

If I open multiple tabs, I noticed the CPU/ram on my server shooting to maximum, and after a little research, it seemed that rather than filtering, it's returning the ENTIRE collection of products. According to the APM, the filter is {}:

image

I added some console.log's on the client prior to calling the query, to make sure that the route had correctly retrieved the id from the URL, and that has been working correctly:

image

In the embody I added a console.log at the end of the embody function to log the filters and params being passed, and according to the server they're being received properly. It looks like the embody function properly has the filters...

But then the APM confirms that it's querying the ENTIRE collection, and this is the data being returned to the client:

image

image

image

No idea why the filters aren't applying. The argument is being sent with the query, embody is properly receiving it and applying it to the body.$filters... Yet it's still querying the entire collection.

I've tested this with other pages as well (Orders page/order view query, etc) and the same thing is happening. So it's not exclusive to any specific page.

Any suggestions or ideas as to why the filters aren't applying?

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

No branches or pull requests

1 participant