-
Notifications
You must be signed in to change notification settings - Fork 78
Description
Enhancement
When you go to use router.link for a route that has an query parameter (path?{someQueryParam}), that parameter must defined for it not to return undefined. This can be problematic in cases where that query parameter is optional, and you do not want to explicitly set it. Making it required can mean you have to give it some placeholder value and remove it at a later point with route.replace, which is an undesireable work around.
There might be some side effects to making it optional that we would need to consider.
Package Version: 6.0.0
Code
In a process:
routerState.currentRoute = 'path';
routerState.currentParams = { query: 'placeholder' };
Then later we have to remove it:
link = link.replace('?query=placeholder', '');
Expected behavior:
Can just set the currentRoute without having to set currentParams
Actual behavior:
Have to set both currentRoute and currentParams, then strip it out. Also potentially have to add checks to where that query paramter is used to make sure it isn't the placeholder value.