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

Missing implementation of URL templates with m.route.Link #2477

Closed
erikvullings opened this issue Jul 17, 2019 · 3 comments · Fixed by #2537
Closed

Missing implementation of URL templates with m.route.Link #2477

erikvullings opened this issue Jul 17, 2019 · 3 comments · Fixed by #2537
Assignees
Labels
Type: Bug For bugs and any other unexpected breakage
Milestone

Comments

@erikvullings
Copy link
Contributor

Mithril version: v2.0.0-rc.9

Browser and OS:: any

Code

Flems: see here

// Code
const item = {
  id: 42
};

m.render(
  document.body,
  m(m.route.Link, { href: "/edit/:id", options: { params: { id: item.id }}}, 'my link')
);

Expected Behavior

As the documentation specifies here, I would expect that the created link contains the supplied parameters, e.g. in the example above, if item.id: 42, it should link to #!/edit/42.

Current Behavior

The parameters are ignored, and the URL template is generated as such, i.e. the link becomes #!/edit/:id

@erikvullings erikvullings added the Type: Bug For bugs and any other unexpected breakage label Jul 17, 2019
@dead-claudia
Copy link
Member

The fix is two-step:

  1. Remove that from the docs altogether for now. It's wrong, and there currently isn't that functionality.
  2. Add a params: attribute to m.route.Link to add that functionality directly. The name here aligns with m.request and m.jsonp who use it to similar effect.

@dead-claudia
Copy link
Member

Do note that adding the params bit will wait until a minor update to v2, potentially v2.1.

dead-claudia added a commit to dead-claudia/mithril.js that referenced this issue Jul 17, 2019
@dead-claudia
Copy link
Member

Okay, that snippet was removed from the site docs. The only thing remaining is part 2.

@dead-claudia dead-claudia added this to the 2.1.0 milestone Jul 24, 2019
coffeacloudberry added a commit to coffeacloudberry/galleria that referenced this issue May 31, 2022
@dead-claudia dead-claudia moved this to Closed in Triage/bugs Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug For bugs and any other unexpected breakage
Projects
Status: Closed
Development

Successfully merging a pull request may close this issue.

2 participants