sindresorhus/refined-github

Disconnect observers in `deinit` #4484

fregante posted onGitHub

This is a minor cleanup: https://twitter.com/jaffathecake/status/1405437361643790337

ResizeObserver & IntersectionObserver need to be manually disconnected, else they leak memory through their callback.

This happens in all browsers.

MutationObserver and event listeners don't have this issue.

Implementation example: https://github.com/sindresorhus/refined-github/blob/8ca75a97bf92ade57b220f9945a06e3eee865c9c/source/features/sticky-sidebar.tsx#L29


Related: https://github.com/sindresorhus/refined-github/issues/4008#issuecomment-812885528

But that is a change in features/index.tsx while this issue is in the features themselves.

posted by fregante almost 4 years ago
posted by fregante over 3 years ago

Fund this Issue

$0.00
Funded

Pull requests