hyperapp-router icon indicating copy to clipboard operation
hyperapp-router copied to clipboard

WIP: BasePath

Open kidandcat opened this issue 7 years ago • 6 comments

Include Basepath

kidandcat avatar Apr 25 '18 16:04 kidandcat

Codecov Report

Merging #70 into master will decrease coverage by 4.05%. The diff coverage is 57.14%.

Impacted file tree graph

@@            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 data Powered by Codecov. Last update 8db6747...65b39fd. Read the comment docs.

codecov[bot] avatar Apr 25 '18 16:04 codecov[bot]

What is the benefit of the basepath property comparing to this simple concatenation ?

const basepath = "demo"
// ...
<Route path={`${basepath}/topic`} render={Topic} />

Swizz avatar Apr 25 '18 20:04 Swizz

@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. 🤔

jorgebucaran avatar Apr 26 '18 01:04 jorgebucaran

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 avatar Apr 26 '18 07:04 kidandcat

@kidandcat We should add features to the Router which are impossible to add from the outside. Couldn't you solve this problem in userland?

jorgebucaran avatar Apr 26 '18 07:04 jorgebucaran

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

kidandcat avatar May 02 '18 10:05 kidandcat