Skip to content

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

@SpyridonZ

Description

@SpyridonZ

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions