Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Simplify the router to just use render functions #2506

Closed
dead-claudia opened this issue Aug 7, 2019 · 1 comment
Closed

Simplify the router to just use render functions #2506

dead-claudia opened this issue Aug 7, 2019 · 1 comment
Assignees
Labels
Area: Core For anything dealing with Mithril core itself Type: Breaking Change For any feature request or suggestion that could reasonably break existing code Type: Enhancement For any feature request or suggestion that isn't a bug fix
Milestone

Comments

@dead-claudia
Copy link
Member

Mithril version:

Browser and OS:

Project:

Is this something you're interested in implementing yourself? Very.

Description

Change the routes in the router to just be "route": (attrs) => vnode functions.

// Current
m.route(elem, "/", {
	"/": Home,
	"/foo/:id": FooView,
})

// Proposed
m.route(elem, "/", {
	"/": () => m(Home),
	"/foo": ({id}) => m(FooView, {id}),
})

This would also entail making m.route.SKIP work with the render function, so we can retain that core functionality.

Why

Simplifies our router API greatly. Together with a built-in Async component, this covers the full API for route resolvers in a way that's just generally more flexible and pluggable for users. It's also simpler to implement.

Possible Implementation

Open Questions

@dead-claudia dead-claudia added Type: Breaking Change For any feature request or suggestion that could reasonably break existing code Type: Enhancement For any feature request or suggestion that isn't a bug fix labels Aug 7, 2019
@dead-claudia dead-claudia added this to the v3 milestone Aug 7, 2019
@dead-claudia dead-claudia self-assigned this Aug 7, 2019
@ycadaner-merkos302
Copy link

This is unnecessary.

  • Provides unnecessary addition to framework
  • Doesn't create any better code habits.
    "don't fix what isn't broken"

@dead-claudia dead-claudia added the Area: Core For anything dealing with Mithril core itself label Sep 2, 2024
@dead-claudia dead-claudia moved this to Under consideration in Feature requests/Suggestions Sep 2, 2024
@MithrilJS MithrilJS locked and limited conversation to collaborators Sep 2, 2024
@dead-claudia dead-claudia converted this issue into discussion #2931 Sep 2, 2024
@github-project-automation github-project-automation bot moved this from Under consideration to Completed/Declined in Feature requests/Suggestions Sep 2, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
Area: Core For anything dealing with Mithril core itself Type: Breaking Change For any feature request or suggestion that could reasonably break existing code Type: Enhancement For any feature request or suggestion that isn't a bug fix
Projects
Status: Completed/Declined
Development

No branches or pull requests

2 participants