qwik icon indicating copy to clipboard operation
qwik copied to clipboard

QwikLoader initialized more than once

Open dario-piotrowicz opened this issue 3 years ago • 0 comments

Basic Info

  • Qwik Version 0.0.113
  • macOS Monterey (Chrome v.105)

Which component is affected?

Qwik Runtime

Description of the Issue

It seems like the qwikLoader gets initialized multiple times, thus accumulating eventListeners and causing unwanted behaviours.

I have a project in which I am using different Qwik fragments loaded dynamically, and there I can see that each time a new fragment is loaded I get extra duplicate events from Qwik.

I don't think this is the expected behaviour since it makes working with isolated Qwik fragments quite problematic.

I think the bug has been introduced in PR #1212, as you can see from these changes: Screenshot 2022-09-26 at 22 51 06

As you can see in the changes before there was a check, making sure that the qR field was falsy, and if it were then it would be initialized to 1 (thus preventing additional initializations of the qwikLoader for that specific document), now this qR field is only getting checked and not initialized.

By a quick regex search I also think that this qR field is not being initialized anywhere else: Screenshot 2022-09-26 at 23 00 41

From the PR I can also see that the eventListeners are added to the document instead of adding them to doc is that correct? shouldn't they be added to doc?

dario-piotrowicz avatar Sep 26 '22 22:09 dario-piotrowicz