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

Support optional query params in routing configuration #901

Merged
merged 4 commits into from
May 12, 2021

Conversation

agubler
Copy link
Member

@agubler agubler commented May 12, 2021

Type: feature

The following has been addressed in the PR:

Description:

At the moment all query params defined in the routing configuration are considered mandatory, however there are times where a query params is optional but still need the router to generate the link correctly (depending on if the optional query param value is passed).

This changes adds a new ? indicator if a query param is to be considered optional:

{
    path: 'my/routes/path?{requiredQueryParam}&{optionalQueryParam?}'
}

The ? before the closing brace tells the router that the param is not required.

Resolves #508

@agubler agubler requested a review from matt-gadd May 12, 2021 10:36
@codesandbox-ci
Copy link

codesandbox-ci bot commented May 12, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 0259f6b:

Sandbox Source
dojo/dojo-codesandbox-template Configuration

@codecov
Copy link

codecov bot commented May 12, 2021

Codecov Report

Merging #901 (0259f6b) into master (ccaedb3) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #901      +/-   ##
==========================================
+ Coverage   94.59%   94.60%   +0.01%     
==========================================
  Files         127      127              
  Lines        8137     8139       +2     
  Branches     1901     1900       -1     
==========================================
+ Hits         7697     7700       +3     
+ Misses        440      439       -1     
Impacted Files Coverage Δ
src/routing/Router.ts 100.00% <100.00%> (+0.45%) ⬆️

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 ccaedb3...0259f6b. Read the comment docs.

@agubler agubler merged commit b740597 into dojo:master May 12, 2021
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.

Make defining params optional for router.link
2 participants