fix(lazyloader): fix trying to run inexistent callbacks #833
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Not a big sample size, but I saw this error in our app logs:
https://ops.grafana-ops.net/a/grafana-lokiexplore-app/explore/service/Hosted%20Grafana%20-%20Prod/logs?patterns=%5B%5D&var-fields=&var-ds=grafanacloud-logs&var-filters=service_name%7C%3D%7CHosted%20Grafana%20-%20Prod&var-filters=kind%7C%3D%7Cexception&var-patterns=&var-lineFilter=%7C~%20%60%28%3Fi%29kl%5C.callbacks%5C%5Bt%5C.target%5C.id%5C%5D%20is%20not%20a%20function%60&var-logsFormat=%20%7C%20logfmt&urlColumns=%5B%5D&visualizationType=%22logs%22&var-labelBy=$__all&var-fieldBy=page_url&from=now-12h&to=now&timezone=browser
Basically trying to call an inexistent callback. By assumption is that it is a race condition, where the callback is deleted before the
IntersectionObserver
stopped observing. Thus, moving the deletion of callbacks after the unobserve call of theInteractionObserver
and making sure the callback is a function.