Code Monkey home page Code Monkey logo

Comments (6)

Airblader avatar Airblader commented on July 23, 2024

Thanks for reporting an issue and providing a Stackblitz! Just to be clear, the issue you are bringing up is that when I change the second dropdown, an event emits for select1 (but still with the correct value), correct?

from ngqp.

osahner avatar osahner commented on July 23, 2024

Yes. Sorry for the short description - still playing around with some other issues I have.
distinctUntilChanged would be the workaround.

from ngqp.

Airblader avatar Airblader commented on July 23, 2024

Thanks for clarifying! This does deserve a bit of background explanation. A fundamental design decision in ngqp is to make the route the single source of truth. This means that changing the dropdown writes to the URL, and ngqp listens to the URL to synchronize the model from. These are essentially two independent processes.

So in this case, changing the value updates the URL, and then because ngqp also listens for the URL, we get a navigation event and from there emit on the observables. The problem, however, is that we don't know which parameters changed with this navigation event.

Of course we could bake distinctUntilChanged into ngqp directly. But this would mean no-op value changes would not emit, which is also unexpected, and not in line with Angular forms. An even bigger reason is that with the current way the user has both options (by adding distinctUntilChanged or not), but if we bake it into ngqp we take away this option from the user.

In principle I think this is all still true, adding distinctUntilChanged is easy enough, and as such I'm incline to say this works as intended. A quick thought I just had, however, is that we could possibly pass information on which parameters have been changed in the navigation state (we already do something similar for programmatic changes).

I'll leave this issue open like this for this thought, but in the meantime I think adding distinctUntilChanged is the intended solution and not so much of a workaround. Does that work for you?

from ngqp.

osahner avatar osahner commented on July 23, 2024

Sure, just a small Note in the docs would be nice.

from ngqp.

Airblader avatar Airblader commented on July 23, 2024

Yes, a note in the documentation would definitely be a good idea as well. Feel free to submit a PR if you want :-)

from ngqp.

osahner avatar osahner commented on July 23, 2024

😉 I will

from ngqp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.