Appsilon / shiny.router

A minimalistic router for your Shiny apps.
http://appsilon.github.io/shiny.router
Other
255 stars 31 forks source link

Returning to main page via url and passing wrong path #28

Closed krystian8207 closed 6 years ago

krystian8207 commented 6 years ago

I suppose there is no possibility to get back to the main page just removing some part of url. When I move to: app_url/#!/other and want to return to main page by passing url: app_url/#!/ it still returns to app_url/#!/other. Moreover passing app_url/#!/wrong_path still returns to app_url/#!/other (not to the default page). Is this target behaviour? Could you verify above issues? Thank you.

dokato commented 6 years ago

Here you probably refer to the basic example.

1) The main page in this example is defined as /. Currently we support / as default and named pages with hashtags #!/ (due to the way shiny parses the links). app_url/#!/ construct is recognised as wrong path and thus nothing is going on. You should type app_url/ instead to return to the main. One solution could be that we treat /#!/ and / as the same path, or we don't allow / to be a main page. Not sure what is more natural from user perspective, though.

2) Yes, so currently if the link is not recognised it will take you back to the previous page. Do you think we should rather come back to the main one? Or maybe parametrise that behaviour as a router option?

Maybe @przytu1, @filipstachura have some thoughts on that?

filipstachura commented 6 years ago

Ad 1. I would say that using app_url/ is acceptable in this case. Ad 2. The most common way is to allow to specify 404 page. We can provide default 404 layout and allow to customize it. Returning to a previous/main page is misleading and shouldn't be probably our default.

dokato commented 6 years ago

In 1 I see one problem. Since new approach relies on hashpaths, only links with hash are parsed correctly, eg. app_url/#!/?a=1 and not app_url/?a=1. We can force it, but I don't think it's very neat solution.

dokato commented 6 years ago

Fixed in #31 and #32 .