Closed janwidmer closed 5 years ago
Why should you even include gondel multiple times? Just want to figure out the environment of this issue ..
I knew that question will come.. ;-) imagine nitro with some prototype js including a button to trigger an overlay on it's demo page..the button was done as gondel component and included in the proto.js entrypoint..that leads to it containing a second gondel core..
Of course the button could be done as plain js which also works..
Type of issue
The issue refers to:
the gondel core
Expected behavior
Loading the gondel core library multiple times should still trigger a click event only once per click.
Current behavior
If the gondel core library is loaded multiple times a click event is fired multiple times for a single click.
The reason for this bug is the GondelDecorators plugin which hooks itself multiple times in the start event.
There is already a code which tries to prevent this bug however it uses a local variable which will not prevent the bug if gondel is included in multiple different files: https://github.com/namics/gondel/blob/b00e01157f11b8eb886f6b11d4d8f22d02d00bb3/packages/core/src/GondelDecorators.ts#L23
Steps to reproduce the behavior
Possible solution:
Use a global window variable instead of a local variable