Skip to content

get() passes search to before hook #99

@makinde

Description

@makinde

https://github.com/travist/resourcejs/blob/master/Resource.js#L559

When the before hook is called, it passes search as the item instead of query. Why is that? It makes it harder to write hooks because index() passes the query as item. It'd be great to be consistent and have them both pass query. That seems like the way to go since you can still access search via the query.

The only problem is that this is a breaking change. Folks could be depending on search being passed instead of query. Might be something to flag for the next major version bump?

I'm currently working around this by accessing the query through req.modelQuery. It works, but is a strange dependency to have between my before handlers and before hooks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions