Replies: 23 comments
-
This is a neat idea, will take a look this evening and probably send a few PRs. |
Beta Was this translation helpful? Give feedback.
-
Brilliant, thanks @tivac 👍 |
Beta Was this translation helpful? Give feedback.
-
@tivac, take a look at: |
Beta Was this translation helpful? Give feedback.
-
Hi everyone, just an update: TL;DR
I'm extremely excited about Mithril (have been using it in production for at least a year) and would love for it to become more mainstream, it's one of those libs that allows you to leave work at 17:00 👍 Thanks to everyone for helping to grow and maintain this project! |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Awesome! Thanks for the feedback @tivac
|
Beta Was this translation helpful? Give feedback.
-
What about SSR? Do you plan to do this? I can assist in this space if you want |
Beta Was this translation helpful? Give feedback.
-
Thanks for the feedback @orbitbot :)
|
Beta Was this translation helpful? Give feedback.
-
@StephanHoyer Oh cool! Hadn't planned on it, but if you're offering... Then, hell yes! |
Beta Was this translation helpful? Give feedback.
-
@tivac Re: 3. domain + api-adapter Do you mind posting a simple example of what your implementation looks like? |
Beta Was this translation helpful? Give feedback.
-
Just my few cents for what it is worth. So following that principle, this var routes = {
'/': {
view: function () {
return m(LayoutDefault, m(ScreenHome));
}
},
'/article/:slug': {
view: function () {
return m(LayoutDefault, m(ScreenArticle));
}
},
'/register': {
view: function () {
return m(LayoutDefault, m(ScreenUserRegister));
}
...
} might be perhaps possible to shorten to var routes = {
'/': () => m(LayoutDefault, m(ScreenHome)),
'/article/:slug': () => m(LayoutDefault, m(ScreenArticle)),
'/register': () => m(LayoutDefault, m(ScreenUserRegister)),
...
} or even var routes = {
'/': LayoutDefault(ScreenHome),
'/article/:slug': LayoutDefault(ScreenArticle),
'/register': LayoutDefault(ScreenUserRegister),
...
} The last one would be a portable general syntax with no specific library dependency, You can even go "functionally crazy" and write it like var routeConfig = {
'/': ScreenHome,
'/article/:slug': ScreenArticle,
'/register': ScreenUserRegister,
...
}
var routes = R.map(LayoutDefault, routeConfig)
// or
var routes = routeConfig.map(LayoutDefault) From the code organisation perspective, the I have found the directory structure really well done in the angular real world example, with no directory having more than 10 or so files. Perhaps I would move the Another things that might make it easier to play and rearrange folders, var domain = require('./../../domain'); Nothing major, but could make life sweeter a bit :) Or am I missing any downside here? |
Beta Was this translation helpful? Give feedback.
-
@dmitriz That's not how RouteResolvers work. They're a specifically-shaped object that mithril treats differently to enable persistent layout components. |
Beta Was this translation helpful? Give feedback.
-
@tivac I am just saying it might be simpler to write the routes that way for the library consumer, so might be worth to support pure functions instead of the more verbose and complex components, where pure view functions is quite often (always in this app) all you need. Basically, there are two ways:
The first way would make it more user-friendly in my view. Does it make sense? |
Beta Was this translation helpful? Give feedback.
-
Is there a reason for the https://github.com/barryels/realworld-mithril/blob/master/src/ui/components/UserSettingsForm.js#L6 Because Null is the Saruman of Static Typing. :) |
Beta Was this translation helpful? Give feedback.
-
@dmitriz Thanks for the feedback, quite valuable discussion points.
Example This component: should probably live here:
|
Beta Was this translation helpful? Give feedback.
-
Was just defining the shape of the state object, so that it's clear that some function is going to have to update that reference :) |
Beta Was this translation helpful? Give feedback.
-
Re: absolute paths, methinky something like rollup's root import is what you'd want, if you're aware of it or not ;) |
Beta Was this translation helpful? Give feedback.
-
Ah, yes, requires using es6 modules though? |
Beta Was this translation helpful? Give feedback.
-
Perhaps in this specific case, there are probably alternatives for other environments & toolchains... |
Beta Was this translation helpful? Give feedback.
-
You are welcome!
I can see your point. I still hope it can be made less verbose when staying simple. Also, does the router API not allow for any tree hierarchy, where I can put the
I am myself against deep nesting that are often abused with zillions of tiny files doing almost nothing. But your components are already 2 levels deep, so it wouldn't increase any depth with more subdirs inside |
Beta Was this translation helpful? Give feedback.
-
RouteResolver: Something more like this? i.e. just DRYing the code up a bit?
|
Beta Was this translation helpful? Give feedback.
-
That would look nicer to me! Or even restrict the router to the intermediate |
Beta Was this translation helpful? Give feedback.
-
I'm busying setting up a Mithril implementation of the Realworld app.
Would really appreciate feedback / contributions at barryels/realworld-mithril or (more high level) at: gothinkster/realworld#69
Beta Was this translation helpful? Give feedback.
All reactions