-
-
Notifications
You must be signed in to change notification settings - Fork 259
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
setupOnerror is running twice in Octane-3.15 #768
Comments
Dug a little deeper this morning, the second issue is coming from
And in this case, |
Seeing the exact same issue. Note that I also get this issue when using the old way of overwriting Ember.onerror, too. I initially thought this error was popping up due to not using the new approach (I'm migrating to Octane, presently) but that is clearly not the case. |
Can you make a runnable demo repo, might make it easier to dig in. Also, I suspect that this is not actually an issue in |
Looks like what is happening is that there is a second error that is thrown during tear down itself. I’ll need to dig in a bit more to see why it changed specifically, but given that it is introduced in 3.13 I believe that it is likely related to the auto tracking work. Thank you for the reproduction! |
3.12.1 is working https://github.com/ELepolt/test-helpers-example-lts/ |
Hi, I have the same issue in the project I am working right now. Triaging the error I have found that activating the optional feature It can be reproduced in the same repo that @ELepolt has shared: https://github.com/ELepolt/test-helpers-example. I hope it helps. Regards. |
Currently we don't do any cleanup in the event of an error occuring during the actual execution of the VM. This can leave the VM in a bad state, in particular the element builder, since it doesn't actually finalize block nodes until _after_ the entire block has executed. This means that if an error occurs during the execution of a block, the VM will never properly initialize those blocks, and their first and last nodes will be `null`. While we don't currently support recovering from this type of an error, we do need to be able to cleanup the application after one, specifically for tests. Previously, this worked no matter what because of the Application Wrapper optional feature - there was always a root `div` element that we could clear, so there was always a first and last node for us to track. With the feature disabled, we started seeing failures such as [this issue within user tests](emberjs/ember-test-helpers#768 (comment)). This PR refactors VM updates, specifically, to allow them to properly clean up the element builder on failures. It now closes all remaining open blocks, finalizing them to ensure they have nodes. This only works for VM updates because the initial append is an _iterator_, which the user controls execution of. We'll need to have a different strategy for this API, but it shouldn't be a regression at the moment because any failures during the iteration will result in a completely broken app from the get-go. There is no result, and no accompanying `destroy` function, so existing tests and apps cannot be affected by failures during append.
Currently we don't do any cleanup in the event of an error occuring during the actual execution of the VM. This can leave the VM in a bad state, in particular the element builder, since it doesn't actually finalize block nodes until _after_ the entire block has executed. This means that if an error occurs during the execution of a block, the VM will never properly initialize those blocks, and their first and last nodes will be `null`. While we don't currently support recovering from this type of an error, we do need to be able to cleanup the application after one, specifically for tests. Previously, this worked no matter what because of the Application Wrapper optional feature - there was always a root `div` element that we could clear, so there was always a first and last node for us to track. With the feature disabled, we started seeing failures such as [this issue within user tests](emberjs/ember-test-helpers#768 (comment)). This PR refactors VM updates, specifically, to allow them to properly clean up the element builder on failures. It now closes all remaining open blocks, finalizing them to ensure they have nodes. This only works for VM updates because the initial append is an _iterator_, which the user controls execution of. We'll need to have a different strategy for this API, but it shouldn't be a regression at the moment because any failures during the iteration will result in a completely broken app from the get-go. There is no result, and no accompanying `destroy` function, so existing tests and apps cannot be affected by failures during append.
FWIW, fixes for this are incoming. Main upstream fix (and explanation) in glimmerjs/glimmer-vm#1073, but we are working to get those glimmer-vm changes landed in Ember releases now. Likely to be fixed for 3.16 and 3.18+. |
When manually asserting an error in a component,
setupOnerror
is running twice, the first timeerr.message
is the expected error, and the second time I'm receivingCannot read property 'firstNode' of null
.Steps to reproduce:
my-component.js
my-component-test.js
The output from the above test is slightly different than my production output:
I also tested this in the LTS version and it did not occur, it simply ran once with the expected
err.message
.My apologies if this is user error.
The text was updated successfully, but these errors were encountered: