Skip to content
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

Fixed generation of url with optional parameter and without default value #523

Merged
merged 5 commits into from
Dec 27, 2017

Conversation

adamjez
Copy link
Contributor

@adamjez adamjez commented Dec 20, 2017

Fixed bug in generating url and added UI tests.

Currently there is a bug with generating url with optional parameter and without specifying default values
(client side rendering)

e.g. Url ControlSamples/Repeater/RouteLink/{Id?} generates /ControlSamples/Repeater/RouteLink/%7BId?}

There is still different behavior when rendering at client/server side:

  • client: ControlSamples/Repeater/RouteLink/
  • server: ControlSamples/Repeater/RouteLink

@adamjez adamjez requested a review from exyi December 20, 2017 11:51
@adamjez adamjez changed the title Fixed generation of url with optional parameter without default value Fixed generation of url with optional parameter and without default value Dec 20, 2017
@adamjez
Copy link
Contributor Author

adamjez commented Dec 24, 2017

Fixed the url generation at client side when a route contains optional parameter.

Current implementation of dotvvm routes and url generation a little bit messy. Specification of routes format doesn't exists (except source code). There exists two implementations (client and server side) which generates urls.

To correct it I would suggest these steps:

  1. Create a route format specification - valid route formats with lot of examples
  2. Create mechanism to share implementations of url generation. It may consists of translating UrlBuilders to javascript dynamically or sharing same regex which generates url.

I would like to hear your opinions: @exyi @djanosik

Copy link
Member

@exyi exyi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, this is probably going to work. Thanks.

@exyi
Copy link
Member

exyi commented Dec 25, 2017

I think that you are right with the specification, it should contain precise grammar of the route strings + the examples explaining the grammar. Actually, I'm afraid that we will need to write specification of almost everything - technically, there are no bugs in dotvvm, because the source code is the specification :)

About the translation fo UrlBuilders - I think that it is a good idea, but the JS compiler simply isn't mature enough - naively translating them now would generate ugly expression like (function (p) { return (function(_) { return "/rr" })(p) + ...)({Id: SomeExpression...}) and it would require adding support for basic Dictionary operations.

@djanosik
Copy link
Contributor

It sounds good to me. But we should file another issue to solve this.

@exyi
Copy link
Member

exyi commented Dec 27, 2017

Merging this PR as a bug fix. I have created separate issues for the translation of UrlBuilders #526 and specification riganti/dotvvm-docs#49

@exyi exyi closed this Dec 27, 2017
@exyi exyi reopened this Dec 27, 2017
@exyi exyi merged commit fdd414b into riganti:master Dec 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants