Closed cancan101 closed 2 years ago
So if you bind events before our insertion-observer had time to do anything at all (which would be very early), we have a race condition and things fail.
I guess manually calling out to insertion_observer()
from api.observe.bind()
to ensure it's always initialized could be an option?
What do you think?
I guess manually calling out to insertion_observer() from api.observe.bind() to ensure it's always initialized could be an option?
That sounds reasonable. I guess an alternative would be to change the predicate to:
observer && api.tracker.watchdog && api.tracker.watchdog.dom[observer]
So if you bind events before our insertion-observer had time to do anything at all (which would be very early), we have a race condition and things fail.
I am not seeing this regularly but when I looked over my extensions's error logs, I did see at least once instance of this.
That sounds reasonable. I guess an alternative would be to change the predicate to:
observer && api.tracker.watchdog && api.tracker.watchdog.dom[observer]
I guess that might be simpler and since insertion_observer()
will only need to be called after we’ve registered an event, fixing it locally there is probably a better idea.
I went for the simpler approach. This should now be fixed in git master.
Let me know if helps :)
Updated on npmjs in version 1.0.23
.
It looks like this line is sometimes hit with
api.tracker.watchdog
not having been setup: https://github.com/KartikTalwar/gmail.js/blob/fe51f121362441ff17cea8a8008b309692f50895/src/gmail.js#L2658from: https://github.com/KartikTalwar/gmail.js/blob/fe51f121362441ff17cea8a8008b309692f50895/src/gmail.js#L2179-L2190