hyperapp-router
hyperapp-router copied to clipboard
WIP: BasePath
Include Basepath
Codecov Report
Merging #70 into master will decrease coverage by
4.05%. The diff coverage is57.14%.
@@ Coverage Diff @@
## master #70 +/- ##
==========================================
- Coverage 100% 95.94% -4.06%
==========================================
Files 6 6
Lines 68 74 +6
Branches 11 14 +3
==========================================
+ Hits 68 71 +3
- Misses 0 3 +3
| Impacted Files | Coverage Δ | |
|---|---|---|
| src/Route.js | 70% <57.14%> (-30%) |
:arrow_down: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update 8db6747...65b39fd. Read the comment docs.
What is the benefit of the basepath property comparing to this simple concatenation ?
const basepath = "demo"
// ...
<Route path={`${basepath}/topic`} render={Topic} />
@kidandcat
I am sure your idea is well intended Jairo, but do you think is it that useful to most Hyperapp Router users? I am curious, but not very keen on adding this feature, at least not at first sight. 🤔
I'm having a separate hyperapp app as a widget: https://github.com/kidandcat/newsuncork/blob/master/src/apps/product-creator.jsx
And I'm instancing it here: https://github.com/kidandcat/newsuncork/blob/master/src/components/CreateProduct.jsx
I'll investigate why today, but when it loads, the location of CreateProduct.jsx's router is "/" (but the URL path is /admin/product/create)
PD: I've added "WIP" to the PR name, if I find the reason of why the router is getting the initial path as "/" I will write you here. However, if at the end this is not usefull to most users, I will just close the PR and use my fork.
@kidandcat We should add features to the Router which are impossible to add from the outside. Couldn't you solve this problem in userland?
I couldn't do it in the userland, but I managed to do it in a much more cleaner way:
https://github.com/hyperapp/router/pull/72
@jorgebucaran