fix: invalidate module in createQwikPlugin slows down cypress component tests #7726
+7
−15
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What is it?
Description
invalidateModule
is used for HMR in VitehandleHotUpdate
hook. It was added in a69de93 in an attempt to make sure that QRLs also get updated on parent changes.The problem is that this causes cypress component tests (CCTs) to be 10x slower, eventually leading to CCTs startup timing out with a "Error: Code(5): You can render over a existing q:container. Skipping render()." message.
I tried many possible combinations of updating the child, the parent, the jsx, the useVisibleTask, the useTask, the QRL outside of the component... I haven't been able to trigger a case where the
invalidateModule
in thetransform
hook with the optimizer would ever run.What seems to happen is that the
handleHotUpdate
hook will invalidate the module, which will then trigger thetransform
hook for the corresponding module and its QRLs.Here's an example log:
Conclusion: We should remove the
invalidateModule
in the transform hook because it impacts CCTs and it seems to never run. Even if it runs rare occasions, it's more important to enable CCTs to work rather than HMR in rare circumstances.If someone can give me a reproduction of when QRLs don't get updated on parent change, I can reassess and try to find a fix that works both for CCTs and HMR.
Checklist
pnpm change