question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Prevent Browser Plugin to Navigate to Default Route in case of CANNOT_ACTIVATE Error

See original GitHub issue

Hello, In my custom canActivate function I check if a user has the rights to access a specific route. If not then I manage to show a modal window to tell the user why he can’t do so.

The problem is that when manually changing the url in the browser then the browser plugin creates a different behaviour.

That is: on a CANNOT_ACTIVATE error my modal is correctly open but soon after this code will run and will redirect the user to the default page (home for example).

Is there a way to disable this behaviour? Whenever a user cannot activate a route (whether or not using the browser plugin) I want the user to remain where he was originally, my custom logic will take care of showing modal and/or redirect.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
trochcommented, Sep 4, 2017

@LeonardoGentile I’ll add an option to the browser plugin

0reactions
LeonardoGentilecommented, Sep 4, 2017

thank you @troch 👍

  1. If we don’t specify defaultRoute then we will not get any redirection even for not found routes, right?

  2. Instead of handling the multiple use cases (redirection on not found route, redirection on route that could not be activated, etcr) I guess that if you better document the errors listed here (ROUTE_NOT_FOUND, SAME_STATES, CANNOT_DEACTIVATE and so on) you could leave to the users (us) the logic for redirection

The second point is related to #176. It’s still not clear to me how to catch navigation error when manually changing the url when using the browser plugin. The browser plugin calls the router navigate method, but since we are not calling it manually we can’t pass error handlers to it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Prevent routing in Angular when user manually changes url in ...
I am stuck in a issue that happens when user manually changes the route in browser tab and presses enter. This ...
Read more >
Web service error codes (Microsoft Dataverse) - Power Apps
Message: Unable to activate or deactivate routing rule set record for entities (except case entity) as the feature control bit for entity ...
Read more >
Modern client-side routing: the Navigation API
In this case the old navigation is abandoned in favour of the new navigation. The user clicks the 'stop' button in the browser....
Read more >
Configuring and managing networking Red Hat Enterprise ...
Setting the default gateway on an existing connection using the nmcli interactive ... For further details and how to avoid this problem, see...
Read more >
Allow or block apps and extensions - Chrome Enterprise and ...
Otherwise, your users can't access the Chrome Web Store to browse or install apps and extensions, including ones that you allow. By default,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found