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

Implement Query filters #3034

Closed
rkirov opened this issue Jul 13, 2015 · 10 comments
Closed

Implement Query filters #3034

rkirov opened this issue Jul 13, 2015 · 10 comments
Labels
effort1: hours feature Issue that requests a new feature

Comments

@rkirov
Copy link
Contributor

rkirov commented Jul 13, 2015

To support more flexible queries implement an option to pass filter to Query. For example: @Query(MyFeature.filter) list: QueryList<dynamic> where static filter(obj) => obj is Foo || obj is Bar.

see discussion on #1935 for more info.

@rkirov rkirov added feature Issue that requests a new feature comp: core effort1: hours labels Jul 13, 2015
@rkirov rkirov self-assigned this Jul 13, 2015
@rkirov rkirov added this to the alpha-32 milestone Jul 13, 2015
@matanlurey
Copy link
Contributor

👍

@rkirov rkirov modified the milestones: alpha-33, alpha-32 Jul 20, 2015
@rkirov
Copy link
Contributor Author

rkirov commented Jul 23, 2015

Needs more design, as discussed passing every object through an opaque filter will prohibit further optimizations down the road.

@rkirov rkirov modified the milestones: alpha-34, alpha-33 Jul 23, 2015
@rkirov
Copy link
Contributor Author

rkirov commented Jul 30, 2015

Discussed with Misko, we should tackle benchmarking query and performance improvements first before adding more general APIs.

@jhades
Copy link

jhades commented Aug 11, 2015

I just wanted to mention that this feature could be more important than it might look at first sight. There are a lot of common use cases that seem to need this feature, take for example a menu with sub-menus:

<top-menu>
    <option title="Menu Entry 1"></option>
    <option title="Menu Entry 2 "></option>
    <option-group title="Menu Entry 3 dropdown Sub menu">
        <option title="sub-menu entry 1"></option>
        <option title="sub-menu entry 2"></option>
        <option-group title="Submenu entry 3 dropdown menu">
            <option title="Sub-Submenu entry 1"></option>
            <option title="Sub-Submenu entry 2"></option>
        </option-group>
    </option-group>
</top-menu>

In this case I believe we need to have in the top-menu @Component a QueryList of both the optionand option-group light-dom element directives. So we can loop over that list and render it as either an entry or a submenu.

Or is there some other alternative way of implementing this with the current API? Thanks

@mhevery
Copy link
Contributor

mhevery commented Aug 21, 2015

Let's not implement this just yet, as it may have negative perf improvement. Let's make sure that we have real use cases, which can not be implemented in other ways.

@rkirov rkirov removed their assignment Aug 31, 2015
@bduffany
Copy link

bduffany commented Sep 2, 2015

@mhevery
Copy link
Contributor

mhevery commented Jan 27, 2016

I think the latest thinking is now, as it would prevent compile time generation of the queries. Will close.

/cc @tbosch

@mhevery mhevery closed this as completed Jan 27, 2016
@bduffany
Copy link

@mhevery could you explain what you mean by that last comment?

@tbosch
Copy link
Contributor

tbosch commented Jan 29, 2016

We will soon calculate the queries already during compilation.
With that, any filter function would need to be executed during compile
time as well. However, we don't have a good way to configure things that
need to run during compilation, as compilation will soon also run on the
server.

We could add a filter function that we just call on the query result, but
then there would be no benefit to a user filtering the result of a query
manually.
I would vote for not adding filters as it is one more concept that a user
has to learn, and does not provide a big benefit.

On Fri, Jan 29, 2016 at 10:20 AM Brandon Duffany notifications@github.com
wrote:

@mhevery https://github.com/mhevery could you explain what you mean by
that last comment?


Reply to this email directly or view it on GitHub
#3034 (comment).

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
effort1: hours feature Issue that requests a new feature
Projects
None yet
Development

No branches or pull requests

6 participants