themesberg / themesberg/flowbite
popover.js - memory leak
Open
@zoltanszogyenyi is already working on this.
Since Dec 7, 2022.
enhancement
v1.6.3
- Dominant language
- HTML
- Stars
- 9.4k
- Forks
- 862
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
popover.js - eventListeners added mutiple times
show() {
...
modifiers: [
...options.modifiers,
{ name: 'eventListeners', enabled: true }, // concatenation at each call
]
options.modifiers is an array, so the above code keep on adding new object at each call of show().
The same mistake is in hide() function.
You should change it to something like that:
function enableListeners(modifiers: Modifier<any, any>[], value: boolean) {
const modifier = modifiers.find((x) => x.name === 'eventListeners');
if (!modifier) return [...modifiers, { name: 'eventListeners', enabled: open }];
modifier.enabled = value;
return modifiers;
}
show() {
...
modifiers: enableListeners(options.modifiers)
...
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.