tall-dinner-62086
03/15/2023, 12:21 PMmysterious-toddler-20573
03/15/2023, 1:03 PMminiature-lizard-24702
03/15/2023, 1:23 PMshy-knife-59740
03/15/2023, 3:35 PMabundant-dog-96915
03/15/2023, 3:41 PMshy-knife-59740
03/15/2023, 3:48 PMshy-knife-59740
03/15/2023, 3:48 PMorange-umbrella-16693
03/15/2023, 3:49 PMripe-action-67367
03/15/2023, 3:50 PMshy-knife-59740
03/15/2023, 3:51 PMshy-knife-59740
03/15/2023, 3:51 PMripe-action-67367
03/15/2023, 3:51 PMarr = arr
because compiler can only track explicit assignments, so if you used mutating array functions or updated specific object fields - tough luckorange-umbrella-16693
03/15/2023, 3:51 PMshy-knife-59740
03/15/2023, 3:52 PMabundant-planet-84751
03/15/2023, 3:52 PMorange-umbrella-16693
03/15/2023, 3:58 PMmysterious-toddler-20573
03/15/2023, 4:56 PMmysterious-toddler-20573
03/15/2023, 4:58 PMhundreds-cartoon-20446
03/15/2023, 6:42 PMbody
here is the culprit, as you're using it inside a timeout:
https://github.com/bigskysoftware/htmx/blob/560b3140740f4be386acd044af7568ed7ae19557/src/htmx.js#L3403
Changing as follows seems to stop detached dom nodes accumulating:
js
setTimeout(function () {
triggerEvent(body, 'htmx:load', {}); // give ready handlers a chance to load up before firing this event
body = null; // kill reference for gc
}, 0);
Can anyone else verify this? You can test your project by looking at how the graph of dom nodes varies over time in Chrome's performance monitor tool.mysterious-toddler-20573
03/15/2023, 7:08 PMmysterious-toddler-20573
03/15/2023, 7:08 PMmysterious-toddler-20573
03/15/2023, 7:09 PMmysterious-toddler-20573
03/15/2023, 7:09 PMhundreds-cartoon-20446
03/15/2023, 7:27 PMhundreds-cartoon-20446
03/15/2023, 7:28 PMhundreds-cartoon-20446
03/15/2023, 7:29 PMmysterious-toddler-20573
03/15/2023, 7:30 PMmysterious-toddler-20573
03/15/2023, 7:32 PMmysterious-toddler-20573
03/15/2023, 7:32 PMhundreds-cartoon-20446
03/15/2023, 7:45 PMsetTimeout()
problem a few times before. It’s usually best to created references to dom nodes inside the function, rather than reuse an existing one, because the garbage collector will refuse to mark it for collection.