Giter Site home page Giter Site logo

Comments (5)

Sayan751 avatar Sayan751 commented on June 8, 2024 1

In that case, it will remain as string. We can improve that when #1734 is implemented.

from aurelia.

Sayan751 avatar Sayan751 commented on June 8, 2024

Hi @elitastic! Thanks for reporting this. If I am not wrong, then this is the same as the Aurelia 1 router. That is, the value of the parameters are converted to string regardless of types.

I think that rather than ignoring the null and undefined from this rule, we can simply leave the other type of values such as number and boolean as they are. Any other kinds of parameters values will be continued to be processed, as it is currently being done.

@bigopon What do you think about that?

from aurelia.

bigopon avatar bigopon commented on June 8, 2024

No objection, it does indeed feel not getting what we see. For apps migrating from v1, maybe we can explain this isn't a nice behavior so it's changed. But what happens when params come from the url?

from aurelia.

elitastic avatar elitastic commented on June 8, 2024

In Aurelia 1, optional null/undefined parameters are ignored, that's why it results in undefined, which is more useful than 'undefined' in my optinion.

from aurelia.

Sayan751 avatar Sayan751 commented on June 8, 2024

By optional parameter, I have understood something like this: route/:param?. However, by optional parameters you meant the parameters not defined for route, and thus putting into the query. Note that as for handling the query, the URLSearchParams API is used, and it is not supported to preserve the type of the values, and everything is converted to string.

I do understand, that you are only looking for the absence of such parameters in the query, when the value is null or undefined. I found that to be loss of data. @bigopon I am a bit torn on this issue.

from aurelia.

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.