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.

New Promise API seems to break `next(false)` implementation in guard

See original GitHub issue

Version

3.1.1

Reproduction link

https://jsfiddle.net/ox6qpz9t/1/

Steps to reproduce

  • Open console
  • Click in foo button that will navigate programmatically to foo route (with replace method) that has a beforeEnter guard.
  • In the console de error Uncaught (in promise) false will appear when navigation is being aborted in guard with next(false)

What is expected?

Abort navigation without error

What is actually happening?

Aborted navigation with unhandled promise error in console.


In version 3.0.7, with the old API (not the new one that returns a promise) was working fine.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

30reactions
Ashtoniancommented, Aug 12, 2019

It is a breaking change if somebody has to change code to implement the new library and maintain the same behavior.

8reactions
posvacommented, Aug 8, 2019

it’s not a major api change. It is even backwards compatible, we can still use callbacks but now when no callbacks are provided, the navigation abortion is visible unless the promise is caught

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught (in promise) undefined - Vue-router - Stack Overflow
Based on my experience over the past few days, it is critical to catch errors in the function that calls this.$router.push() .
Read more >
Error handling with promises
Asynchronous actions may sometimes fail: in case of an error the corresponding promise becomes rejected. For instance, fetch fails if the remote server...
Read more >
25. Promises for asynchronous programming - Exploring JS
The Promise API is about delivering results asynchronously. A Promise object (short: Promise) is a stand-in for the result, which is delivered via...
Read more >
Node.js v19.3.0 Documentation
If your code is callback-based, it is enough to promisify it with util.promisify() so it starts working with native promises. If you need...
Read more >
How To Handle Async Data Loading, Lazy Loading, and Code ...
React has a special component called Suspense that will display placeholders while the browser is loading your new component. In future versions ...
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