Prevent hooks from affecting other hooks #9
hendrikheil
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've recently added a few hooks to an internal Nuxt module I've built. We're using the hookable instance provided by Nuxt to make sure there is only one instance of hookable around.
I spent a bit of time debugging an issue with some listeners I registered. Essentially, I only saw the first listener being executed, but none of the others.
I traced this down to my first listener causing an exception, which caused the other hooks not to execute. I think it might be useful to isolate hook calls in a try catch block to ensure listeners cannot affect each other.
I'm not sure this change will cause unintended changes, so I wanted to pose this question before working on a PR.
I did see that there is a test for the current behavior "should throw hook error".
Beta Was this translation helpful? Give feedback.
All reactions