Giter Site home page Giter Site logo

Comments (7)

bigopon avatar bigopon commented on May 28, 2024 2

So far, from what I see, this issue boils down to the router.load with the following differences:

  1. Working:
    router.load({
      id: 'recipe-details',
      parameters: { recipeId: '52767' }
    })
    // or
    router.load({
      id: 'recipe-details',
      parameters: { recipeId: '52767' }
    }, {
      origin: undefined
    })
  2. not working:
    router.load({
      id: 'recipe-details',
      parameters: { recipeId: '52767' }
    }, { 
      origin: the_anchor_with_href_to_the_recipe_page
    })

It means the presence of the origin, which is the <a> element, in the router.load options breaks it.
cc @jwx

from aurelia.

bigopon avatar bigopon commented on May 28, 2024 1

@migajek I clicked on the normal link, clicking on the underlined link gave me the same errors, thanks!

from aurelia.

johnmanko avatar johnmanko commented on May 28, 2024

@migajek

Have you tried changing parameters.bind to params.bind?

From the docs:

And where things start to get interesting is when you want to pass parameters to a route. We use the params configuration property to specify parameters.

from aurelia.

migajek avatar migajek commented on May 28, 2024

@johnmanko unfortunately the docs is simply wrong on this, as stated in the comment here by @jwx :
#1835 (comment)

In router, the load bindables are id and parameters

This seems to be indeed the case:

@bindable public parameters?: Parameters;
...
@bindable public id?: string;

https://github.com/aurelia/aurelia/blob/master/packages/router/src/resources/load.ts#L17

from aurelia.

migajek avatar migajek commented on May 28, 2024

Did a little debugging.
The LinkHandler that does the actual router.load when the a is clicked, receives the following call:

image

This ends up with the following error
image

However when I call the similar load directly from the controller code (so I use <a click.trigger="myMethod(.. instead of <a load="id: .., parameters.bind: ..) it loads fine.

the only obvious difference, except for the call context, is the lack of { origin: target } in my controller call.

Now, when I added the {origin: $event.target} to mimic the LinkHandler behavior, I'm getting the exact same exception.

But why? Well, that's beyond my understanding :)

from aurelia.

bigopon avatar bigopon commented on May 28, 2024

This is the log I get after clicking around in the recipes page:
image

Stackblitz is at https://stackblitz.com/edit/au2-conventions-vbk6gr

Everything seems to work fine, I'm using beta-13 though. Can you help try repro again @migajek ?

from aurelia.

migajek avatar migajek commented on May 28, 2024

@bigopon I ran yours repro, headed to recipes and clicked the underlined item. This is what I ended up with:

image

please note I haven't touched anything.

I tried it in 3 browsers:

  • Chrome 122
  • Firefox 121
  • Edge 122

all running Windows 10.
Also checked in incognito mode of Chrome and Firefox just to make sure.
Each time I'm getting the error as in the screenshot above.

What browser are you running? Are you sure you clicked the underlined link of the recipe? The underlined links for each recipe (on the right hand side) are supposed to repro the bug; the regular links work just fine

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.