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

FIX: uses simpler patternj for custom href on extra nav items #8015

Merged

Conversation

jjaffeux
Copy link
Contributor

@jjaffeux jjaffeux commented Aug 17, 2019

The main advantage of this solution is that it will be called on each re-render whereas the previous is not once href has been set.

Example API:

      api.addNavigationBarItem({
        name: "foo",
        displayName: "Foo",
        customHref: function(category, args) {
          const router = api.container.lookup("service:router");
          const queryParams = { bar: "1" };
          return router.urlFor(router.currentRouteName, category, {
            queryParams
          });
        }
      });

THe main advantage of this solution is that it will be called on each rerendered whereas the other is not once href has been set.

Example API:
```
      api.addNavigationBarItem({
        name: "foo",
        displayName: "Foo",
        customHref: function(category, args) {
          const router = api.container.lookup("service:router");
          const queryParams = { bar: "1" };
          return router.urlFor(router.currentRouteName, category, {
            queryParams
          });
        }
      });
```
@discoursebot
Copy link

You've signed the CLA, jjaffeux. Thank you! This pull request is ready for review.

@SamSaffron
Copy link
Member

Cool, I say we try this out!

@SamSaffron SamSaffron merged commit 897cdfb into discourse:master Aug 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants