# Loading route not working when only optional param changes

**URL:** <https://discourse.aurelia.io/t/loading-route-not-working-when-only-optional-param-changes/5143>\
**Category:** vNext\
**Created:** [April 5, 2023, 9:59am UTC](https://discourse.aurelia.io/t/loading-route-not-working-when-only-optional-param-changes/5143 "2023-04-05T09:59:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![elitastic](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/elitastic/32/1787_2.png) [@elitastic](https://discourse.aurelia.io/u/elitastic)\
**Post date:** [April 5, 2023, 9:59am UTC](https://discourse.aurelia.io/t/loading-route-not-working-when-only-optional-param-changes/5143/1 "2023-04-05T09:59:26Z")

</div>

I cannot force a route reload when an optional parameter changes, even if I provide a custom transition plan:

> **[routing within same route v2 - StackBlitz](https://stackblitz.com/edit/au2-conventions-ggko5j)**
>
> Run Aurelia application with conventions

Is this a bug?

---

<div class="post-metadata">

**Author:** ![elitastic](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/elitastic/32/1787_2.png) [@elitastic](https://discourse.aurelia.io/u/elitastic)\
**Post date:** [April 5, 2023, 12:46pm UTC](https://discourse.aurelia.io/t/loading-route-not-working-when-only-optional-param-changes/5143/3 "2023-04-05T12:46:35Z")

</div>

I thought, transitionPlan as navigation option was the goal of the following pull request:

> <https://github.com/aurelia/aurelia/pull/1718>
>
> \<!---
> Thanks for filing a pull request 😄 ! Before you submit, please read the f…ollowing:
> 
> Search open/closed issues before submitting since someone might have pushed the same thing before!
> \--\>
> 
> \# Pull Request
> 
> \## 📖 Description
> 
> \<!---
> Provide some background and a description of your work.
> \--\>
> 
> This is reported here: https://discourse.aurelia.io/t/router-lite-navigate-to-optional-param-within-same-route/5115
> 
> cc: @elitastic 
> 
> \### 🎫 Issues
> 
> \<!---
> \* List and link relevant issues here.
> \--\>
> 
> \## 👩‍💻 Reviewer Notes
> 
> \<!---
> Provide some notes for reviewers to help them provide targeted feedback.
> \--\>
> 
> \## 📑 Test Plan
> 
> \<!---
> Please provide a summary of the tests affected by this work and any unique strategies employed in testing the features/fixes.
> \--\>
> 
> \## ⏭ Next Steps
> 
> \<!---
> If there is relevant follow-up work to this PR, please list any existing issues or provide brief descriptions of what you would like to do next.
> \--\>
> 
> Docs and demo.
> 
> \<!--
> Love Aurelia? Please consider supporting our collective:
> 👉 https://opencollective.com/aurelia
> \--\>

---

<div class="post-metadata">

**Author:** ![Sayan751](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/sayan751/32/1861_2.png) [@Sayan751](https://discourse.aurelia.io/u/Sayan751)\
**Post date:** [April 5, 2023, 1:20pm UTC](https://discourse.aurelia.io/t/loading-route-not-working-when-only-optional-param-changes/5143/4 "2023-04-05T13:20:33Z")

</div>

@elitastic I think by “optional” parameters you are actually referring to unconfigured parameters. Those parameters will be put to query string ultimately. And by changing the value of querystring, you cannot trigger a transition, because there are no changes in the configured part of parameters.

However, I have revisited your earlier [thread](https://discourse.aurelia.io/t/router-lite-navigate-to-optional-param-within-same-route/5115) and it seems that my PR not yet fully supports the Au1 use-case. Let me find a solution for that.

In the mean time, here is an working workaround: [routing within same route v2 (forked) - StackBlitz](https://stackblitz.com/edit/au2-conventions-ksibj3?file=src%2Fmy-app.ts)

---

<div class="post-metadata">

**Author:** ![Sayan751](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/sayan751/32/1861_2.png) [@Sayan751](https://discourse.aurelia.io/u/Sayan751)\
**Post date:** [April 7, 2023, 6:41pm UTC](https://discourse.aurelia.io/t/loading-route-not-working-when-only-optional-param-changes/5143/5 "2023-04-07T18:41:10Z")

</div>

@elitastic The feature added in the PR does work. When I last checked your example, I have missed one little thing. There was a misconfiguration. The correction would look like as follows.

```diff
    this.router.load(
      {
        component: 'product-route',
        params: {
          id: 'product-1',
          optional: optionalParam,
        },
- transitionPlan: 'invoke-lifecycles',
      },
      {
+ transitionPlan: 'invoke-lifecycles',
        context: this.routeContext.parent,
      }
    );

```

Here is a working [fork](https://stackblitz.com/edit/au2-conventions-e2lwg7?file=src%2Fproduct.html,src%2Fproduct.ts,src%2Fmy-app.ts,webpack.config.js).
