adamlui / chatgpt-auto-refresh

↻ Keeps ChatGPT sessions fresh to avoid network errors + Cloudflare checks
https://chatgptautorefresh.com
Other
178 stars 12 forks source link

MutationObserver #14

Closed madkarmaa closed 1 year ago

madkarmaa commented 1 year ago

I've been using your same logic to append the elements to ChatGPT's website. Thing is, I'm planning on implementing stuff that needs a lot of calculations, and if I try to add the logic and append the elements, the website just freezes. Why am I telling you this? Because I can't figure out how to fix it and I think you can implement it too if you find out how.

What's the "bug"? The MutationObserver adds the logic/elements to the DOM as many times as it's ran. Let's say I want to listen for a click event, that event is added multiple times and is fired multiple times.

adamlui commented 1 year ago

@madkarmaa this script doesn't freeze because insertToggle() is super simple and mutations already remove the previously inserted toggles so there's no debt. I'd have to see your code to know what bug you're referring to, if you create an issue in the pertinent repo then tag me I can help you fix it